ADDITIONAL SYSTEM INFORMATION :
Mac OS
A DESCRIPTION OF THE PROBLEM :
The array is set with zeros during the execution of the IntStream.range(0, 0x0010_0000).filter(...).count(); chain
https://stackoverflow.com/questions/65394902/elements-of-int-can-be-inappropriately-set-to-zero-in-an-implemented-method/65415455#65415455
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
openjdk 11.0.9.1
ACTUAL -
undefined behaviour
---------- BEGIN SOURCE ----------
class Main {
private final static int SIZE = 33;
public static boolean test2(int seed) {
int[] state = new int[SIZE];
state[0] = seed;
for (int i = 1; i < SIZE; i++) {
state[i] = state[i - 1];
}
return seed != state[SIZE - 1];
}
public static void main(String[] args) {
long count = IntStream.range(0, 0x0010_0000).filter(Main::test2).count();
System.out.println(count);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
disable the flag AllowVectorizeOnDemand disable
FREQUENCY : always