ADDITIONAL SYSTEM INFORMATION :
Linux Ubuntu20.04
openjdk version "1.8.0_402"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_402-b06)
OpenJDK 64-Bit Server VM (Temurin)(build 25.402-b06, mixed mode)
openjdk version "11.0.22" 2024-01-16
OpenJDK Runtime Environment Temurin-11.0.22+7 (build 11.0.22+7)
OpenJDK 64-Bit Server VM Temurin-11.0.22+7 (build 11.0.22+7, mixed mode)
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
In TestCase2, the arrays var1 and var7 are initialized using the prodReductionInit function, followed by 2000 iterations of the prodReductionImplement function for simple array operations. However, Hotspot encounters errors in the final results. Testing on Hotspot-8, 11, and 17 reveals that Hotspot-8 and 11 only occasionally output exceptions, whereas Hotspot-17 consistently outputs exceptions when the -Xcomp parameter is set.
We have uploaded the relevant test cases to Google Drive for ease of reproduction.
https://drive.google.com/file/d/1zrFxmAQ2FuS0IjO9NolWuScBr0bPNGag/view?usp=sharing
REGRESSION : Last worked in version 17.0.10
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java-17/bin/java -Xcomp TestCase2
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Success
ACTUAL -
Exception
---------- BEGIN SOURCE ----------
public class TestCase2 {
public static void main(String[] var0) throws Exception {
double[] var7 = new double[262144];
double[] var1 = new double[262144];
prodReductionInit(var7, var1);
double var2 = 2000.0;
double var4 = 0.0;
for(int var6 = 0; var6 < 2000; ++var6) {
var4 = prodReductionImplement(var7, var1, (double)(var6 + 1));
}
if (var4 == var2) {
System.out.println("Success");
} else {
System.out.println("Exception");
}
}
public static double prodReductionImplement(double[] var0, double[] var1, double var2) {
for(int var4 = 0; var4 < var0.length; ++var4) {
var2 *= var0[var4] - var1[var4];
}
return var2;
}
public static void prodReductionInit(double[] var0, double[] var1) {
for(int var5 = 0; var5 < var0.length; ++var5) {
var0[var5] = (double)(var5 + 2);
var1[var5] = (double)(var5 + 1);
double var2 = 1.0;
double[] var4 = new double[100];
}
}
}
---------- END SOURCE ----------
FREQUENCY : always