-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Steps to reproduce the issue
Run the code below with GraalVm to reproceduce the problem.
import java.nio.ByteBuffer;
import java.util.Arrays;
public class GraalVM {
public static void main(String[] args) {
for (int j = 0; j < 10000000; j++) {
byte[] array1 = ByteBuffer.allocate(8).putLong(0).array();
byte[] array2 = new byte[6];
System.arraycopy(array1, 2, array2, 0, array1.length - 2);
if (!Arrays.toString(array2).equals("[0, 0, 0, 0, 0, 0]")) {
System.out.println(j);
System.out.println(Arrays.toString(array1));
System.out.println(Arrays.toString(array2));
}
}
}
}
If everything goes right, the program won't print anything. Actually it will print something like:
2283065
[0, 0, 0, 0, 0, 0, 0, 0]
[61, -38, -82, -31, 0, 0]
2283066
[0, 0, 0, 0, 0, 0, 0, 0]
[1, 0, 0, 0, 0, 0]
2283067
[0, 0, 0, 0, 0, 0, 0, 0]
[-67, -38, -82, -31, 0, 0]
Describe GraalVM and your environment:
- java version "21.0.1" 2023-10-17
- Java(TM) SE Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
- Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
Also meet this problem in mac(arm verion) + GraalVM 17.0.10
OneSizeFitsQuorum, SergejIsbrecht, SteveYurongSu, Cpaulyz and Caideyipi