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

Wrong result with C2 compiled out of bounds array access

XMLWordPrintable

      Attached Test.java fails when C2 compiled.

          static void test() {
              for (int i = 1500; i > 0; i--) {
                  try {
                      int tmp = array[idx--];
                  } catch (Exception e) {
                      // Ignore
                  }
              }
          }

      java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::test -XX:-TieredCompilation -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM Test.java
      Exception in thread "main" java.lang.RuntimeException: Wrong result: -2500 != -1500
      at Test.main(Test.java:43)

            roland Roland Westrelin
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: