JDK-8272574 : C2: assert(false) failed: Bad graph detected in build_loop_late
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u251,11,17,18
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-08-17
  • Updated: 2023-10-04
  • Resolved: 2021-09-14
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 11 JDK 13 JDK 15 JDK 17 JDK 18
11.0.14-oracleFixed 13.0.12Fixed 15.0.8Fixed 17.0.2Fixed 18 b15Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Crash happened when run the following test
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f109e08240b, pid=19518, tid=19536
#
# JRE version: OpenJDK Runtime Environment (18.0) (build 18-internal+0-adhoc.root.jdkdev)
# Java VM: OpenJDK 64-Bit Server VM (18-internal+0-adhoc.root.jdkdev, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xa8f40b]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x13b
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: LoadSplitThruPhi

Host: AMD EPYC 7K62 48-Core Processor, 8 cores, 60000G, CentOS Linux release 7.2 (Final)
Time: Tue Aug 17 19:41:33 2021 CST elapsed time: 0.280694 seconds (0d 0h 0m 0s)

---------------  T H R E A D  ---------------

Current thread (0x00007f10041ba540):  JavaThread "C2 CompilerThread2" daemon [_thread_in_native, id=19536, stack(0x00007f1031cfd000,0x00007f1031dfe000)]


Current CompileTask:
C2:    280  378       4       LoadSplitThruPhi::getPermutations1 (86 bytes)

Stack: [0x00007f1031cfd000,0x00007f1031dfe000],  sp=0x00007f1031df8dc0,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xa8f40b]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x13b
V  [libjvm.so+0xa8fa80]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0x180
V  [libjvm.so+0xa903ab]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x75b
V  [libjvm.so+0x59b1f9]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x149
V  [libjvm.so+0x598c5e]  Compile::Optimize()+0x85e
V  [libjvm.so+0x59aae2]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0xe52
V  [libjvm.so+0x4db911]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x191
V  [libjvm.so+0x5a37f8]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xf68
V  [libjvm.so+0x5a4428]  CompileBroker::compiler_thread_loop()+0x4a8
V  [libjvm.so+0xdfe760]  JavaThread::thread_main_inner()+0x190
V  [libjvm.so+0xe02730]  Thread::call_run()+0xc0
V  [libjvm.so+0xbd04d1]  thread_native_entry(Thread*)+0xe1
Comments
Fix request (13u,15u): Should be backported for parity with major releases. First series of tests run OK.
26-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk15u-dev/pull/213 Date: 2022-05-26 13:58:59 +0000
26-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk13u-dev/pull/352 Date: 2022-05-26 13:18:19 +0000
26-05-2022

Fix Request (11u): Should get backported for parity with 11.0.14-oracle. Applies cleanly.
13-10-2021

Fix request (17u): The bug leads to a crash in C2. The fix is medium risk and has been tested in the JDK 18 for a while and with tier1-3 in JDK 17u. The patch applies cleanly.
28-09-2021

Changeset: 16c3ad1f Author: casparcwang <casparcwang@tencent.com> Committer: Jie Fu <jiefu@openjdk.org> Date: 2021-09-14 20:55:01 +0000 URL: https://git.openjdk.java.net/jdk/commit/16c3ad1ff4d9a0e21f15656c73a96a6c143c811a
14-09-2021

Both of these referred bugs are regressions from JDK-8252372 and do not trigger if we disable split if with -XX:-SplitfBlocks. However, this bug here still reproduces with -XX:-SplitIfBlocks. This is also confirmed by looking at the open review which talks about loop predication without mentioning anything related to JDK-8252372.
18-08-2021

We have two other bugs failing with the same assert: JDK-8272562 and JDK-8271954. Could they be related?
18-08-2021

The test also crashes on debug versions: # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/data/openjdk/jdk_dev/src/hotspot/share/opto/loopnode.cpp:5343), pid=3611, tid=3630 # assert(false) failed: Bad graph detected in build_loop_late # # JRE version: OpenJDK Runtime Environment (18.0) (fastdebug build 18-internal+0-adhoc.root.jdkdev) # Java VM: OpenJDK 64-Bit Server VM (fastdebug 18-internal+0-adhoc.root.jdkdev, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x12f20b7] PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x307 # # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # --------------- S U M M A R Y ------------ Command Line: LoadSplitThruPhi Host: VM_235_31_centos, AMD EPYC 7K62 48-Core Processor, 8 cores, 60000G, CentOS Linux release 7.2 (Final) Time: Wed Aug 18 09:24:33 2021 CST elapsed time: 0.474709 seconds (0d 0h 0m 0s) --------------- T H R E A D --------------- Current thread (0x00007f54542b62c0): JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=3630, stack(0x00007f54945f6000,0x00007f54946f7000)] Current CompileTask: C2: 474 310 4 LoadSplitThruPhi::getPermutations1 (86 bytes) Stack: [0x00007f54945f6000,0x00007f54946f7000], sp=0x00007f54946f12c0, free space=1004k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x12f20b7] PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x307 V [libjvm.so+0x12f255a] PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xba V [libjvm.so+0x12f2ec7] PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x507 V [libjvm.so+0xa1b693] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x283 V [libjvm.so+0xa1827c] Compile::Optimize()+0x102c V [libjvm.so+0xa1a187] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1247 V [libjvm.so+0x83f616] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646 V [libjvm.so+0xa29904] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xd04 V [libjvm.so+0xa2a578] CompileBroker::compiler_thread_loop()+0x598 V [libjvm.so+0x19c4d9e] JavaThread::thread_main_inner()+0x64e V [libjvm.so+0x19cb6e0] Thread::call_run()+0x100 V [libjvm.so+0x1561d64] thread_native_entry(Thread*)+0x104
18-08-2021

ILW = crash/bad graph, seen in one reproducer, no workaround = HLH = P2
17-08-2021