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

C2: wrong result - broken memory graph - arrays with bottom element type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • 11, 17, 21, 22, 23
    • hotspot

      I was inspired by a recent bug found by [~jbhateja]: JDK-8329555

      There, we have a handle to an Object, which we know to be an array, but there are multiple possible element type, say a "byte[]" or "int[]".

      Also JDK-8331054 dealt with such an example.

      Now I found a more general bug. And this with or without UseSuperWord.

      On JDK23, we can run:
      ./java --add-modules java.base --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.util=ALL-UNNAMED -Xbatch -XX:CompileCommand=compileonly,Test::test* -XX:-UseSuperWord Test.java
      CompileCommand: compileonly Test.test* bool compileonly = true
      Exception in thread "main" java.lang.RuntimeException: wrong value
      at Test.main(Test.java:26)

      Also older versions are affected:
      /oracle-work/jdk-11.0.9.0.4/fastdebug/bin/java --add-modules java.base --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.util=ALL-UNNAMED -Xbatch -XX:CompileCommand=compileonly,Test::test* -XX:-UseSuperWord Test.java


      This example may seem quite contrived, with Unsafe. But this is a perfectly reasonable access pattern for MemorySegments. Such an example is what [~jbhateja] encountered in JDK-8329555.

        1. image_0.png
          image_0.png
          181 kB
        2. Test.java
          1 kB

            Unassigned Unassigned
            epeter Emanuel Peter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: