JDK-8252292 : 8240795 may cause anti-dependence to be missed
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 15,16
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-08-25
  • Updated: 2021-01-13
  • Resolved: 2020-08-27
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 15 JDK 16
15.0.2Fixed 16 b14Fixed
Related Reports
Relates :  
Description
I see that with the following loop

for (int i = 0; i < stop; i ++) {
  if (flag1) {
    System.arraycopy(src, 0, dst, 0, j);
    v = dst[9];
    if (flag2) {
      src[9] = 0x42;
    }
  }
}

the value of v that's loaded can be wrong (0x42 when flag2 is true) because of missing anti-dependence between the load (once transformed to a load on src) and store.
Comments
Checked new test compiler/escapeAnalysis/TestMissingAntiDependency.java passed in jdk16 ATR.
13-01-2021

Fix Request (jdk 15u): This fix should be backported because it fixes a regression introduced by JDK-8240795 in jdk 15. The bug could cause incorrect code execution and would be quite hard to diagnose. Fix from jdk 16 applies cleanly. I verified the test fails without the fix and passes with it. I also ran tier1 & tier2 testing. The fix was pushed to jdk 16 a few days and there was not follow up bugs that I'm aware of.
01-09-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/3123bebd1eff User: roland Date: 2020-08-27 13:51:05 +0000
27-08-2020