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

SIGSEGV in LShiftLNode::Ideal due to unexpected dead node

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      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 version "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)

      java 17.0.15 2025-04-15 LTS
      Java(TM) SE Runtime Environment (build 17.0.15+9-LTS-241)
      Java HotSpot(TM) 64-Bit Server VM (build 17.0.15+9-LTS-241, mixed mode, sharing)

      Eclipse Compiler for Java(TM) v20250526-2018, 3.42.0, Copyright IBM Corp 2000, 2020. All rights reserved.

      A DESCRIPTION OF THE PROBLEM :
      Using Eclipse compiler for Java (ECJ) to compile the following test program and running it with HotSpot will cause JVM crash in JDK 11/17. However, OpenJ9 can run the same bytecode successfully.

      Using javac to compile the same test program will execute successfully.

      The ECJ version is 4.36 and can be downloaded from https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.36-202505281830/ecj-4.36.jar

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Using JDK 17, run the following command:
      ```
      java -jar ecj-4.36.jar --release 17 Test.java
      java Test
      ```

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program should execute successfully.
      ACTUAL -
      The program will crash with the following error:
      ```
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007fbdaa2c4648, pid=2673, tid=2686
      #
      # JRE version: Java(TM) SE Runtime Environment (17.0.15+9) (build 17.0.15+9-LTS-241)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.15+9-LTS-241, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xbbe648] LShiftLNode::Ideal(PhaseGVN*, bool)+0x378
      ...
      ```

      ---------- BEGIN SOURCE ----------
      class Test {
          public static void test() {
              int size = 1000;
              int[] arr1 = new int[size];
              int[] arr2 = new int[size];
              for (int i = 0; i < size; i++) {
                  arr1[i] = i;
              }
              for (int i = 0; i < size; i += 10) {
                  for (int j = 0; j < 5; j++) {
                      int srcPos = i + j;
                      int destPos = i + j;
                      int length = 5 - j;
                      java.lang.System.arraycopy(arr1, srcPos, arr2, destPos,
                              length);
                  }
              }
          }

          public static void main(String[] args) {
              for (int i = 0; i < 10_000; i++) {
                  test();
              }
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: