-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P3
-
None
-
Affects Version/s: 8u471
-
Component/s: hotspot
-
generic
ADDITIONAL SYSTEM INFORMATION :
- Operating system: Linux
- Compiler/toolchain: GCC 9.5
- Source commit: 76b626867f7c436e493566c2cc5d6ac847420894 (tag: 1.8.0_492-internal, branch: master)
- Build type: fastdebug (also happens in release version of 1.8.0_492)
- Build environment: Linux, compiled from source with GCC 9.5
- Also happens in 1.8.0_472, released version
A DESCRIPTION OF THE PROBLEM :
A minimal Java program that intentionally triggers an ArithmeticException inside a loop crashes the HotSpot C2 compiler at runtime when forcing compilation with -Xcomp. The crash occurs in the linear-scan register allocator during exception edge resolution:
LinearScan::resolve_exception_edge(XHandler*, int, int, Phi*, MoveResolver&)
The same program executes correctly under the interpreter (-Xint), printing the expected output. The issue reproduces in both fastdebug and release builds of jdk8u-dev and generates hs_err and compiler replay files.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Save the source below as Test.java.
2) Compile: javac Test.java
3) Run with C2 forced:
- fastdebug build:
<path-to-fastdebug-jdk>/bin/java -Xcomp -Xbatch Test
- release build:
<path-to-release-jdk>/bin/java -Xcomp -Xbatch Test
4) Optional: Run with interpreter to see expected output:
<jdk>/bin/java -Xint Test
---------- BEGIN SOURCE ----------
public class Test {
public static int iMeth(boolean b, byte by) {
char varChar = (char)86;
short varShort = (short)176;
double d3 = 0.54161;
int i23 = 4;
int i24 = 76;
int i25 = 140;
int i26 = 59806;
int i27 = -2108;
int i28 = -2;
int i29 = -61;
int i30 = 37746;
int i31 = 137;
int i32 = -36;
int i33 = 10;
int i34 = -226;
int i35 = -13235;
int i36 = -157;
int iArr3[] = new int[128];
float f3 = 0.45F;
float f4 = 7.723F;
float f5 = -12.876F;
long l3 = 808419796L;
long lArr1[][] = new long[128][128];
long varLong = 20883L;
long meth_res = 0;
String str2 = "one";
for (int i = 0; i < iArr3.length; i++) {
iArr3[i] = -29234;
}
for (int i = 0; i < lArr1.length; i++) {
for (int j = 0; j < lArr1[i].length; j++) {
lArr1[i][j] = -2363914597L;
}
}
try {
for (i36 = 0; i36 < 333; i36++) {
l3 = Math.multiplyExact(varLong, varLong);
varChar = ((char) (((char)4)));
i30 = iArr3[((int) (d3 - 1))] / i31;
}
} catch (ArithmeticException a_e) {
}
meth_res = Float.floatToIntBits(f3) +
i23 + i24 + i25 + i26 + l3 +
i27 + i28 + i29 + i30 + i31 +
i32 + i33 + i34 + str2.length() +
Float.floatToIntBits(f4) +
Float.floatToIntBits(f5) +
Double.doubleToLongBits(d3) +
i35 + i36;
System.out.println("char varChar:: " + ((int) (varChar)));
System.out.println("short varShort:: " + varShort);
return (int)meth_res;
}
public static void main(String[] args) {
Test.iMeth(false, ((byte) (16)));
System.out.println("PASS");
}
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS
- Operating system: Linux
- Compiler/toolchain: GCC 9.5
- Source commit: 76b626867f7c436e493566c2cc5d6ac847420894 (tag: 1.8.0_492-internal, branch: master)
- Build type: fastdebug (also happens in release version of 1.8.0_492)
- Build environment: Linux, compiled from source with GCC 9.5
- Also happens in 1.8.0_472, released version
A DESCRIPTION OF THE PROBLEM :
A minimal Java program that intentionally triggers an ArithmeticException inside a loop crashes the HotSpot C2 compiler at runtime when forcing compilation with -Xcomp. The crash occurs in the linear-scan register allocator during exception edge resolution:
LinearScan::resolve_exception_edge(XHandler*, int, int, Phi*, MoveResolver&)
The same program executes correctly under the interpreter (-Xint), printing the expected output. The issue reproduces in both fastdebug and release builds of jdk8u-dev and generates hs_err and compiler replay files.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Save the source below as Test.java.
2) Compile: javac Test.java
3) Run with C2 forced:
- fastdebug build:
<path-to-fastdebug-jdk>/bin/java -Xcomp -Xbatch Test
- release build:
<path-to-release-jdk>/bin/java -Xcomp -Xbatch Test
4) Optional: Run with interpreter to see expected output:
<jdk>/bin/java -Xint Test
---------- BEGIN SOURCE ----------
public class Test {
public static int iMeth(boolean b, byte by) {
char varChar = (char)86;
short varShort = (short)176;
double d3 = 0.54161;
int i23 = 4;
int i24 = 76;
int i25 = 140;
int i26 = 59806;
int i27 = -2108;
int i28 = -2;
int i29 = -61;
int i30 = 37746;
int i31 = 137;
int i32 = -36;
int i33 = 10;
int i34 = -226;
int i35 = -13235;
int i36 = -157;
int iArr3[] = new int[128];
float f3 = 0.45F;
float f4 = 7.723F;
float f5 = -12.876F;
long l3 = 808419796L;
long lArr1[][] = new long[128][128];
long varLong = 20883L;
long meth_res = 0;
String str2 = "one";
for (int i = 0; i < iArr3.length; i++) {
iArr3[i] = -29234;
}
for (int i = 0; i < lArr1.length; i++) {
for (int j = 0; j < lArr1[i].length; j++) {
lArr1[i][j] = -2363914597L;
}
}
try {
for (i36 = 0; i36 < 333; i36++) {
l3 = Math.multiplyExact(varLong, varLong);
varChar = ((char) (((char)4)));
i30 = iArr3[((int) (d3 - 1))] / i31;
}
} catch (ArithmeticException a_e) {
}
meth_res = Float.floatToIntBits(f3) +
i23 + i24 + i25 + i26 + l3 +
i27 + i28 + i29 + i30 + i31 +
i32 + i33 + i34 + str2.length() +
Float.floatToIntBits(f4) +
Float.floatToIntBits(f5) +
Double.doubleToLongBits(d3) +
i35 + i36;
System.out.println("char varChar:: " + ((int) (varChar)));
System.out.println("short varShort:: " + varShort);
return (int)meth_res;
}
public static void main(String[] args) {
Test.iMeth(false, ((byte) (16)));
System.out.println("PASS");
}
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS