title: IntStream leads to array elements being wrongly set to 0 (JVM Bug, Java 11)
body: <p>In the class <code>P</code> below, the method <code>test</code> seems to return identically <code>false</code>:</p>
  <pre class="lang-java prettyprint-override"><code>import java.util.function.IntPredicate;
  import java.util.stream.IntStream;
  
  public class P implements IntPredicate {
      private final static int SIZE = 33;
  
      @Override
      public boolean test(int seed) {
          int[] state = new int[SIZE];
          state[0] = seed;
          for (int i = 1; i &lt; 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(new P()).count();
          System.out.println(count);
      }
  }
  </code></pre>
  <p>Combining class <code>P</code> with <code>IntStream</code>, however, the method <code>test</code> can (wrongly) return <code>true</code>.
  The code in the <code>main</code> method above results in some positive integer, like <code>716208</code>.
  The result changes after every execution.</p>
  <p>This <strong>unexpected behavior</strong> occurs because the <code>int</code> array <code>state[]</code> can be set to zero during the execution.
  If a testing code, such as</p>
  <pre><code>if (seed == 0xf_fff0){
      System.out.println(Arrays.toString(state));
  } 
  </code></pre>
  <p>is inserted at the tail of the method <code>test</code>, then the program will output a line like <code>[1048560, 1048560, 1048560, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</code>.</p>
  <p><strong>Question:</strong> Why can the int array <code>state[]</code> be set to zero?</p>
  <p>I already know how to avoid this behavior: just replacing <code>int[]</code> with <code>ArrayList</code>.</p>
  <p>I examined in:</p>
  <ul>
  <li>windows 10 + and debian 10+ with  OpenJDK Runtime Environment (build 15.0.1+9-18) OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)</li>
  <li>debian 9 + OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)</li>
  </ul>