JDK-8274145 : C2: condition incorrectly made redundant with dominating main loop exit condition
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-09-22
  • Updated: 2022-02-03
  • Resolved: 2021-10-08
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 17 JDK 18
17.0.2Fixed 18 b19Fixed
Related Reports
Relates :  
Description
Attached Fuzzer test produces different result in C2:

$ build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xint Test | grep instanceCount | tail -n 3
Test.instanceCount Test.bFld iFld = -13,0,-1965776755
Test.instanceCount Test.bFld iFld = -13,0,-492785072
Test.instanceCount Test.bFld iFld = -13,0,1109812339

$ build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xcomp -XX:TieredStopAtLevel=1 Test | grep instanceCount | tail -n 3
Test.instanceCount Test.bFld iFld = -13,0,-1965776755
Test.instanceCount Test.bFld iFld = -13,0,-492785072
Test.instanceCount Test.bFld iFld = -13,0,1109812339

$ build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xcomp -XX:-TieredCompilation Test | grep instanceCount | tail -n 3
Test.instanceCount Test.bFld iFld = -13,0,787372637
Test.instanceCount Test.bFld iFld = -13,0,-1876561976
Test.instanceCount Test.bFld iFld = -13,0,139528539

Bisection points to JDK-8269752.
Comments
Fix request (17u): The patch fixes a bug in C2 that leads to incorrect execution of compiled code (regression in JDK 17). The fix is low risk and has been tested in the JDK 18 for a while and with tier1-3 in JDK 17u. The patch applied cleanly.
11-10-2021

Changeset: 2aacd422 Author: Roland Westrelin <roland@openjdk.org> Date: 2021-10-08 14:48:35 +0000 URL: https://git.openjdk.java.net/jdk/commit/2aacd4220a01b467de671212c7a74e6c81a2ad3c
08-10-2021

ILW = Incorrect result with C2 compiled code, only single Java Fuzzer test, no workaround = HLH = P2
22-09-2021