-
Bug
-
Resolution: Unresolved
-
P3
-
11, 17, 21, 22, 23
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[]".
AlsoJDK-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 inJDK-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
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
- relates to
-
JDK-8331054 C2 MergeStores: assert failed: unexpected basic type after JDK-8318446 and JDK-8329555
- Closed