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

JDK 11 HotSpot C2 Compiler Crash in PhaseIterGVN with Infinite Loop Optimization

XMLWordPrintable

    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      wsl2-ubuntu 22.04
      Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

      java 11.0.27 2025-04-15 LTS
      Java(TM) SE Runtime Environment 18.9 (build 11.0.27+8-LTS-232)
      Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.27+8-LTS-232, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      The following test program will crash Java Runtime Environment in JDK 11. However, it executes normally in JDK 8, 17 and 21.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Using JDK 11, run the following command:
      ```
      javac Test.java
      java Test
      ```

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program should execute normally.
      ACTUAL -
      The program will crash Java Runtime Environment.
      ```
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007f136b1d1761, pid=12332, tid=12344
      #
      # JRE version: Java(TM) SE Runtime Environment 18.9 (11.0.27+8) (build 11.0.27+8-LTS-232)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM 18.9 (11.0.27+8-LTS-232, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xc72761] PhaseIterGVN::add_users_to_worklist(Node*)+0x11
      ...
      ```

      ---------- BEGIN SOURCE ----------
      ```
      class Test {

          static int val = 0;

          public static int foo(int val) {
              return val + 1000;
          }

          public static void test() {
              Object[] arr = new Object[10];
              System.arraycopy(arr, 1, arr, 3, 5);
              System.arraycopy(arr, 2, arr, 4, 6);
              for (int i = 0; i < 100; i++) {
                  val = i;
                  if (val == 50) {
                      val = foo(val);
                  }
                  long a = 0L;
                  short b = (short) 123.45;
                  while (true) {
                      b = (byte) i;
                  }
              }
          }

          public static void main(String[] argv) {
              for (int i = 0; i < 15000; i++) test();
          }
      }
      ```
      ---------- END SOURCE ----------

            dskantz Daniel Skantz
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: