JDK-8181742 : Load that bypasses arraycopy has wrong memory state
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-06-07
  • Updated: 2025-10-22
  • Resolved: 2017-06-23
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 10 JDK 9
10Fixed 9 b176Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Following 2 tests currently fail because the load of dst[1] bypasses the arraycopy to load from src but uses the wrong memory state.
    static int test3(int[] src) {
        int[] dst = new int[10];
        System.arraycopy(src, 0, dst, 0, 10);
        src[1] = 0x42;
        return dst[1];
    }

    static int test4(int[] src) {
        int[] dst = (int[])src.clone();
        src[1] = 0x42;
        return dst[1];
    }

Comments
verified w/ the regression test
04-08-2017

URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/2ab74e5dbdc2 User: lana Date: 2017-06-28 20:59:43 +0000
28-06-2017

URL: http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/2ab74e5dbdc2 User: thartmann Date: 2017-06-23 08:40:35 +0000
23-06-2017

All tests passed. I'm pushing this now.
23-06-2017

We still waiting Aurora to do pre-integration testing.
22-06-2017

Approved for JDK 9. Regression fix.
19-06-2017

Fix Request This bug causes an incorrect execution on a very simple test. This is addressed by fixing the broken graph transformation in c2. Change is localized so I would say risk is low. Tested with java/lang, java/util and hotspot jtreg tests with -Xcomp. Change was reviewed by Tobias and Vladimir K webrev: http://cr.openjdk.java.net/~roland/8181742/webrev.00/
19-06-2017

Thanks, Roland. ILW = C2 generates incorrect code, reproducible with very simple test, disable escape analysis = HHM = P1
07-06-2017

Tobias: compiled methods return an incorrect result
07-06-2017

Roland, do these tests fail compilation or crash the compiler?
07-06-2017

Introduced during jdk 9 development by: changeset: 8384:c78f961f7edb user: roland date: Tue May 12 10:27:50 2015 +0200 summary: 8076188: Optimize arraycopy out for non escaping destination
07-06-2017