-
Bug
-
Resolution: Incomplete
-
P4
-
None
-
11
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
As the following test case shows, When I try to” Arrays.fill(newArray, oldCapacity, newArray.length, UNSET);",happens error and return -9.Howerer,HotSpot-jdk17, HotSpot-jdk11,OpenJ9-jdk17,Openj9-jdk11, Zulu-jdk17, Zulu-jdk11, GraalVM-jdk11, GraalVM-jdk17 all return 0 and output correctly.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
536870912
536870912
harness return 0
ACTUAL -
536870912
harness return -9
---------- BEGIN SOURCE ----------
Testcase:
import java.util.Arrays;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.Field;
public class Test {
static int index = 525509982;
static Object value = 0;
static Object[] indexedVariables = { -224785816, 0, -50706295, 0, 7, 6, 3, 429156777, -2112810036, 579060016 };
int expandIndexedVariableTableAndSet(int index, Object value, Object[] indexedVariables) throws Exception {
Object UNSET = new Object();
Object[] oldArray = indexedVariables;
final int oldCapacity = oldArray.length;
int newCapacity = index;
newCapacity |= newCapacity >>> 1;
newCapacity |= newCapacity >>> 2;
newCapacity |= newCapacity >>> 4;
newCapacity |= newCapacity >>> 8;
newCapacity++;
Object[] newArray = Arrays.copyOf(oldArray, newCapacity);
System.out.println(newCapacity);
Arrays.fill(newArray, oldCapacity, newArray.length, UNSET);
return newCapacity;
}
public static void main(String[] args) throws Exception {
System.out.println(new Test().expandIndexedVariableTableAndSet(index, value, indexedVariables));
}
}
---------- END SOURCE ----------
As the following test case shows, When I try to” Arrays.fill(newArray, oldCapacity, newArray.length, UNSET);",happens error and return -9.Howerer,HotSpot-jdk17, HotSpot-jdk11,OpenJ9-jdk17,Openj9-jdk11, Zulu-jdk17, Zulu-jdk11, GraalVM-jdk11, GraalVM-jdk17 all return 0 and output correctly.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
536870912
536870912
harness return 0
ACTUAL -
536870912
harness return -9
---------- BEGIN SOURCE ----------
Testcase:
import java.util.Arrays;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.Field;
public class Test {
static int index = 525509982;
static Object value = 0;
static Object[] indexedVariables = { -224785816, 0, -50706295, 0, 7, 6, 3, 429156777, -2112810036, 579060016 };
int expandIndexedVariableTableAndSet(int index, Object value, Object[] indexedVariables) throws Exception {
Object UNSET = new Object();
Object[] oldArray = indexedVariables;
final int oldCapacity = oldArray.length;
int newCapacity = index;
newCapacity |= newCapacity >>> 1;
newCapacity |= newCapacity >>> 2;
newCapacity |= newCapacity >>> 4;
newCapacity |= newCapacity >>> 8;
newCapacity++;
Object[] newArray = Arrays.copyOf(oldArray, newCapacity);
System.out.println(newCapacity);
Arrays.fill(newArray, oldCapacity, newArray.length, UNSET);
return newCapacity;
}
public static void main(String[] args) throws Exception {
System.out.println(new Test().expandIndexedVariableTableAndSet(index, value, indexedVariables));
}
}
---------- END SOURCE ----------