Internal JIT diagnostic error "LoopLimit opcode 193" during C2 loop optimization

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Software:
          System Software Overview:
            System Version: Ubuntu 22.04.4 LTS
            Kernel Version: 4.15.0-45-generic
            Boot Volume: overlay
            Boot Mode: Legacy BIOS
            Computer Name: 899309ef3feb
            User Name: root
            Time since boot: 21 weeks, 2 days, 6 hours, 47 minutes

      Hardware:
          Hardware Overview:
            Model: Unknown
            Model Identifier: Unknown
            Chip: Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
            Total Number of Cores: 40 (10 physical x 2 logical)
            Memory: 125Gi
            System Firmware Version: Unknown

      A DESCRIPTION OF THE PROBLEM :
      A diagnostic or internal error message from the C2 compiler is triggered when executing a loop with a limit close to Integer.MAX_VALUE and a stride greater than 1. The output suggests an unhandled case in the C2 loop optimizer when calculating the trip count or loop limits for loops that may overflow during the final stride.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. javac Test.java.
      2. java -Xcomp Test

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void main(String[] args) {
              int[] a = new int[1005];
              for (int i = 0; i < 10000; i++) {
                  test((i % 2) == 0, a);
              }
          }

          static void test(boolean flag, int[] a) {
              int x = (flag) ? 1000 : 2147483646;
              for (int i = ((Integer) (0)); i <= x; i += 4) {
                  if (!flag) {
                      return;
                  }
                  a[i] = 34;
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY :
      ALWAYS

            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: