Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8259361

Bug cause by -XX:+AllowVectorizeOnDemand in array with intersecting ranges

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      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


      Attachments

        Issue Links

          Activity

            People

              sswsharm swati sharma (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: