JDK-8293978 : Duplicate simple loop back-edge will crash the vm
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,20
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-09-19
  • Updated: 2022-09-26
  • Resolved: 2022-09-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b16Fixed
Related Reports
Relates :  
Description
After https://bugs.openjdk.org/browse/JDK-8279888, the following simple Test crashes.

class Foo {
  static void c(Byte[] a, Byte d) {
    for (int e = 0; e < a.length; e++)
      a[e] = 0;
  }
}
class Test {
  int f(int g) {
    Byte h[] = new Byte[500];
    Foo.c(h, (byte)4);
    short i = 7;
    while (i != 1)
      i = (short)(i - 3);
    return 0;
  }
  void j(String[] k) {
    try {
      int l = 5;
      if (l < f(l))
        ;
    } catch (Exception m) {
    }
  }
  public static void main(String[] args) {
    try {
      Test n = new Test();
      for (int i=0;i <10000;i++)
        n.j(args);
    } catch (Exception ex) {
    }
  }
}


The crash log is:

Current CompileTask:
C2:    315   24   !   4       Test::j (16 bytes)

Stack: [0x00007fe32b3da000,0x00007fe32b4db000],  sp=0x00007fe32b4d4e00,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x429e55]  Node::in(unsigned int) const+0x13  (node.hpp:391)
V  [libjvm.so+0xf4bd74]  PhaseIdealLoop::verify_strip_mined_scheduling(Node*, Node*)+0xc2  (loopnode.cpp:5733)
V  [libjvm.so+0xf4ca24]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0xa50  (loopnode.cpp:5926)
V  [libjvm.so+0xf4bfd0]  PhaseIdealLoop::build_loop_late_post(Node*)+0x28  (loopnode.cpp:5760)
V  [libjvm.so+0xf4bc54]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0x248  (loopnode.cpp:5706)
V  [libjvm.so+0xf464e1]  PhaseIdealLoop::build_and_optimize()+0xa95  (loopnode.cpp:4387)
V  [libjvm.so+0x8a0df4]  PhaseIdealLoop::PhaseIdealLoop(PhaseIterGVN&, PhaseIdealLoop const*)+0xca  (loopnode.hpp:1100)
V  [libjvm.so+0x8a0eac]  PhaseIdealLoop::verify(PhaseIterGVN&)+0x63  (loopnode.hpp:1158)
V  [libjvm.so+0x894777]  Compile::Optimize()+0xcb5  (compile.cpp:2379)
V  [libjvm.so+0x88d69a]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x13cc  (compile.cpp:823)
V  [libjvm.so+0x77e6e4]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x194  (c2compiler.cpp:113)
V  [libjvm.so+0x8ab589]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x9ed  (compileBroker.cpp:2240)
V  [libjvm.so+0x8aa175]  CompileBroker::compiler_thread_loop()+0x3e7  (compileBroker.cpp:1916)
V  [libjvm.so+0x8c9dd5]  CompilerThread::thread_entry(JavaThread*, JavaThread*)+0x69  (compilerThread.cpp:58)
V  [libjvm.so+0xc4bfd4]  JavaThread::thread_main_inner()+0x164  (javaThread.cpp:700)
V  [libjvm.so+0xc4be64]  JavaThread::run()+0x204  (javaThread.cpp:683)
V  [libjvm.so+0x13a70c8]  Thread::call_run()+0x180  (thread.cpp:224)
V  [libjvm.so+0x10c0b33]  thread_native_entry(Thread*)+0x18f  (os_linux.cpp:710)

Comments
Changeset: cb72f809 Author: casparcwang <casparcwang@tencent.com> Committer: Jie Fu <jiefu@openjdk.org> Date: 2022-09-21 06:24:19 +0000 URL: https://git.openjdk.org/jdk/commit/cb72f80925965c73e32c44ce3196866272306d7f
21-09-2022

ILW = VM crash; corner case in debug and release builds; disable compilation of the affected method = HLM = P3
19-09-2022

Crashed after 8279888 is merged
19-09-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/10329 Date: 2022-09-19 03:30:15 +0000
19-09-2022