ADDITIONAL SYSTEM INFORMATION : $ ./release-jdk/jdk-21.0.2/bin/java -version java version "21.0.2" 2024-01-16 LTS Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58) Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing) $ ./jdk-mainline/build/linux-x86_64-server-fastdebug/jdk/bin/java -version openjdk version "23-internal" 2024-09-17 OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.user.jdk22u) OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.user.jdk22u, mixed mode) $ cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.2 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy A DESCRIPTION OF THE PROBLEM : When I run the following testcase using the jdk 21.0.2 downloaded from [Oracle](https://www.oracle.com/java/technologies/downloads/#jdk21-linux) and the jdk compiled from latest jdk-mainline source code downloaded from (GitHub](https://github.com/openjdk/jdk), I get an incorrect execution result. REGRESSION : Last worked in version 17.0.10 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : pathToJDK21.0.2/.../java -XX:-BackgroundCompilation Test pathToJDK-mainline/.../java -XX:-BackgroundCompilation Test EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - -169310344 ACTUAL - -18140394 ---------- BEGIN SOURCE ---------- class Test { int a = 400; int[] b = new int[a]; void c() { int l, d = 3; for (l = 2; 58 > l; l++) { for (int e = 2; e < 8; e += 2) for (int f = 1; f < e; f += 2) synchronized (new Test()) { } do ; while (d < 2); int g = 0; do g++; while (g < 20000); b[1] -= 3023399; } int h = 0; for (int i = 0; i < b.length; i++) h += b[i]; System.out.println(h); } public static void main(String[] j) { Test k = new Test(); k.c(); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : When BackgroundCompilation is enabled by default, this issue does not occur too frequently. The problem does not arise when using the -Xint option. FREQUENCY : always
|