JDK-8331054 : C2 MergeStores: assert failed: unexpected basic type after JDK-8318446 and JDK-8329555
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-04-24
  • Updated: 2024-04-29
  • Resolved: 2024-04-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b20Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
I just pushed JDK-8318446, and [~jbhateja] just pushed a new test with JDK-8329555.

I did not merge and run tests again in the meantime, so now we have a failure in mainline:

~/Documents/jtreg/bin/jtreg -va -s -jdk:/oracle-work/jdk-fork2/build/linux-x64-debug/jdk -javaoptions:"-XX:-TieredCompilation -XX:+AlwaysIncrementalInline" -J-Djavatest.maxOutputSize=10000000 /oracle-work/jdk-fork2/open/test/hotspot/jtreg/compiler/vectorapi/TestBiMorphicMismatchedMemSegment.java

Flags:
-XX:-TieredCompilation -XX:+AlwaysIncrementalInline

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle-work/jdk-fork2/open/src/hotspot/share/utilities/globalDefinitions.cpp:334), pid=3792327, tid=3792345
#  assert((allow_address || t != T_ADDRESS) && t <= T_CONFLICT) failed: unexpected basic type
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-internal-2024-04-24-1048312.emanuel...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-internal-2024-04-24-1048312.emanuel..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd78a7d]  type2aelembytes(BasicType, bool)+0x5d
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /oracle-work/jdk-fork2/build/linux-x64-debug/jdk/bin/JTwork/scratch/core.3792327)
#
# An error report file with more information is saved as:
# /oracle-work/jdk-fork2/build/linux-x64-debug/jdk/bin/JTwork/scratch/hs_err_pid3792327.log
#
# Compiler replay data is saved as:
# /oracle-work/jdk-fork2/build/linux-x64-debug/jdk/bin/JTwork/scratch/replay_pid3792327.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Comments
ILW = Assert during C2 compilation (regression), reproducible , -XX:-MergeStores = HMM = P2
25-04-2024

Changeset: ea3909ac Author: Emanuel Peter <epeter@openjdk.org> Date: 2024-04-24 19:06:46 +0000 URL: https://git.openjdk.org/jdk/commit/ea3909acd117cab97c6c0b496f98f9a4a3a22be4
24-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18935 Date: 2024-04-24 14:53:49 +0000
24-04-2024

Note: this is definately due to the MergeStores logic from JDK-8318446. With JDK-8329555, Jatin only added a test that triggers the bug.
24-04-2024

The issue is that I assume that array ptr always have a native type. But they can be bottom type, and the BasicType is then T_ILLEGAL, and trying to get the size in bytes leads to the assert. I have attached a proposed fix: patch.diff
24-04-2024