Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8370416

C2: Optimizing away arraycopy leads to wrong execution

XMLWordPrintable

      Found by Olivier Mattmann <olivier.mattmann@bluewin.ch> during work on this Master thesis where he is working on a fuzzer for C2.

      The attached test case (Test.java) leads C2 to optimize away the array copy which in turn leads to a wrong execution. The test case was derived from compiler/arraycopy/TestLoadBypassACWithWrongMem.java introduced in JDK-8181742. The symptoms look similar, but the setup is now more contrived.

      java -XX:-TieredCompilation -Xbatch Test.java
      Exception in thread "main" java.lang.RuntimeException: Wrong result from compiled method test1: 16. Expected: 0
      at Test.main(Test.java:34)

      Possible workarounds: -XX:-DoEscapeAnalysis, -XX:-UseSwitchProfiling, -XX:-UseProfiledLoopPredicate

            Unassigned Unassigned
            mhaessig Manuel Hässig
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: