-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: 17.0.18
-
Component/s: hotspot
-
x86_64
-
linux
ADDITIONAL SYSTEM INFORMATION :
- Operating system: Linux
- Compiler/toolchain: GCC 9.5
- Source commit: a8784a04081a11a41fe0e3bd8ab9fba6af2d3d4d (tag: jdk-17.0.18+4, branch: master)
- Build type: fastdebug
- Coverage: enabled (built with --enable-coverage)
- Build environment: Linux, compiled from source with GCC 9.5
A DESCRIPTION OF THE PROBLEM :
C2 SuperWord assertion failure in fastdebug build: assert(out == prev || prev == nullptr) failed: no branches off of store slice (superword.cpp:1181) when running a small Java test with -Xcomp -Xbatch.
Running the attached small Java program under a fastdebug build of OpenJDK 17u with -Xcomp -Xbatch triggers an internal VM error in the C2 SuperWord optimization phase. The failure is an assertion in SuperWord::mem_slice_preds at superword.cpp:1181: “no branches off of store slice”. The test does not use any unusual constructs; it performs a simple loop writing to a byte array and uses String.indexOf and Float.floatToIntBits. The bug reproduces in my environment with a recent 17u head (tag jdk-17.0.18+4), compiled fastdebug with --enable-coverage, GCC 9.5.
The program’s logical output is deterministic and does not depend on JIT; it should print the same two lines five times. Instead, after a couple of successful iterations, the VM hits the assertion in the C2 compiler. The failure saves hs_err and a compiler replay file.
This appears to be specific to fastdebug (assertion), likely in SuperWord’s handling of a store slice within the first loop that populates a byte[] with a simple linear recurrence. Disabling SuperWord avoids the crash (see Workarounds).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Save the test as Test.java
2) Compile with the fastdebug JDK:
jdk17u/build/linux-x86_64-server-fastdebug/jdk/bin/javac Test.java
3) Run with C2 stress options:
jdk17u/build/linux-x86_64-server-fastdebug/jdk/bin/java -Xcomp -Xbatch Test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
ACTUAL -
After one or two successful iterations, the VM aborts with:
Internal Error (src/hotspot/share/opto/superword.cpp:1181)
assert(out == prev || prev == nullptr) failed: no branches off of store slice
Problematic frame:
V [libjvm.so+0x...] SuperWord::mem_slice_preds(Node*, Node*, GrowableArray<Node*>&)+0x...
hs_err_pidXXXX.log and replay_pidXXXX.log are produced.
---------- BEGIN SOURCE ----------
public class Test {
static class Cls {
public static byte gbByteVar = (byte)75;
}
public static boolean bFld = false;
public void mainTest(String[] strArr1) {
int lvInt1 = -138;
int lvInt2 = -138;
float f3 = 92.589F;
String lvStr = "xmrjueawszzseso";
byte[] lvByte = new byte[32];
for (int TmpVar = 0; TmpVar < 32; TmpVar++) {
lvInt2 = lvStr.indexOf(((int)(Cls.gbByteVar)));
lvByte[TmpVar] = ((byte) ((((byte) (TmpVar)) * 5) + 12));
}
if (Test.bFld) {
for (int TmpVar = 130; TmpVar > f3; TmpVar--) {
lvInt2 = Integer.numberOfTrailingZeros(lvInt1 - lvInt2);
}
}
System.out.println("f3 = " + Float.floatToIntBits(f3));
System.out.println("Test.bFld = " + (Test.bFld ? 1 : 0));
}
public static void main(String[] strArr) {
Test _instance = new Test();
for (int i = 0; i < 5; i++) {
_instance.mainTest(strArr);
}
}
}
---------- END SOURCE ----------
- Operating system: Linux
- Compiler/toolchain: GCC 9.5
- Source commit: a8784a04081a11a41fe0e3bd8ab9fba6af2d3d4d (tag: jdk-17.0.18+4, branch: master)
- Build type: fastdebug
- Coverage: enabled (built with --enable-coverage)
- Build environment: Linux, compiled from source with GCC 9.5
A DESCRIPTION OF THE PROBLEM :
C2 SuperWord assertion failure in fastdebug build: assert(out == prev || prev == nullptr) failed: no branches off of store slice (superword.cpp:1181) when running a small Java test with -Xcomp -Xbatch.
Running the attached small Java program under a fastdebug build of OpenJDK 17u with -Xcomp -Xbatch triggers an internal VM error in the C2 SuperWord optimization phase. The failure is an assertion in SuperWord::mem_slice_preds at superword.cpp:1181: “no branches off of store slice”. The test does not use any unusual constructs; it performs a simple loop writing to a byte array and uses String.indexOf and Float.floatToIntBits. The bug reproduces in my environment with a recent 17u head (tag jdk-17.0.18+4), compiled fastdebug with --enable-coverage, GCC 9.5.
The program’s logical output is deterministic and does not depend on JIT; it should print the same two lines five times. Instead, after a couple of successful iterations, the VM hits the assertion in the C2 compiler. The failure saves hs_err and a compiler replay file.
This appears to be specific to fastdebug (assertion), likely in SuperWord’s handling of a store slice within the first loop that populates a byte[] with a simple linear recurrence. Disabling SuperWord avoids the crash (see Workarounds).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Save the test as Test.java
2) Compile with the fastdebug JDK:
jdk17u/build/linux-x86_64-server-fastdebug/jdk/bin/javac Test.java
3) Run with C2 stress options:
jdk17u/build/linux-x86_64-server-fastdebug/jdk/bin/java -Xcomp -Xbatch Test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
f3 = 1119432081
Test.bFld = 0
ACTUAL -
After one or two successful iterations, the VM aborts with:
Internal Error (src/hotspot/share/opto/superword.cpp:1181)
assert(out == prev || prev == nullptr) failed: no branches off of store slice
Problematic frame:
V [libjvm.so+0x...] SuperWord::mem_slice_preds(Node*, Node*, GrowableArray<Node*>&)+0x...
hs_err_pidXXXX.log and replay_pidXXXX.log are produced.
---------- BEGIN SOURCE ----------
public class Test {
static class Cls {
public static byte gbByteVar = (byte)75;
}
public static boolean bFld = false;
public void mainTest(String[] strArr1) {
int lvInt1 = -138;
int lvInt2 = -138;
float f3 = 92.589F;
String lvStr = "xmrjueawszzseso";
byte[] lvByte = new byte[32];
for (int TmpVar = 0; TmpVar < 32; TmpVar++) {
lvInt2 = lvStr.indexOf(((int)(Cls.gbByteVar)));
lvByte[TmpVar] = ((byte) ((((byte) (TmpVar)) * 5) + 12));
}
if (Test.bFld) {
for (int TmpVar = 130; TmpVar > f3; TmpVar--) {
lvInt2 = Integer.numberOfTrailingZeros(lvInt1 - lvInt2);
}
}
System.out.println("f3 = " + Float.floatToIntBits(f3));
System.out.println("Test.bFld = " + (Test.bFld ? 1 : 0));
}
public static void main(String[] strArr) {
Test _instance = new Test();
for (int i = 0; i < 5; i++) {
_instance.mainTest(strArr);
}
}
}
---------- END SOURCE ----------