JDK-8269752 : C2: assert(false) failed: Bad graph detected in build_loop_late
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-07-01
  • Updated: 2022-11-30
  • Resolved: 2021-07-19
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 17 JDK 18
17 b32Fixed 18Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The attached Java Fuzzer test starts to fail after JDK-8252372 with the following assertion:

To reproduce:
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test Test.java
$  java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Reduced Reduced.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/35546316-ed70-4084-8244-d672e7734fd1-S57035/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/41fc080c-d2db-43a6-87b0-daa1149175bc/runs/ea6bcc43-d159-4998-ab37-df1970ab9b47/workspace/open/src/hotspot/share/opto/loopnode.cpp:5331), pid=19558, tid=19572
#  assert(false) failed: Bad graph detected in build_loop_late
#
# JRE version: Java(TM) SE Runtime Environment (17.0+28) (fastdebug build 17-ea+28-LTS-2534)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+28-LTS-2534, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1307677]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x307
............
Command Line: -Xmx1G -Xcomp -Xbatch -XX:-TieredCompilation -XX:CompileOnly=Test -XX:CompileCommand=quiet Test
............
Current thread (0x00007f440847fc40):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=19572, stack(0x00007f43ec8f8000,0x00007f43ec9f9000)]


Current CompileTask:
C2:    391    5    b        Test::vMeth (360 bytes)

Stack: [0x00007f43ec8f8000,0x00007f43ec9f9000],  sp=0x00007f43ec9f3310,  free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1307677]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x307
V  [libjvm.so+0x1307b1a]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xba
V  [libjvm.so+0x1308487]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x507
V  [libjvm.so+0xa2a6aa]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2da
V  [libjvm.so+0xa26fc5]  Compile::Optimize()+0x14f5
V  [libjvm.so+0xa28b48]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1618
V  [libjvm.so+0x849aa6]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646
V  [libjvm.so+0xa397a9]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xfb9
V  [libjvm.so+0xa3a518]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x18b8251]  JavaThread::thread_main_inner()+0x271
V  [libjvm.so+0x18bff70]  Thread::call_run()+0x100
V  [libjvm.so+0x158c7c4]  thread_native_entry(Thread*)+0x104
Comments
Changeset: c1304519 Author: Roland Westrelin <roland@openjdk.org> Date: 2021-07-19 07:31:28 +0000 URL: https://git.openjdk.java.net/jdk17/commit/c1304519b56e44d1d4e380d0b9839a8b09385e6d
19-07-2021

Fix request approved
16-07-2021

17 Fix request: This fixes a crash in c2 that's triggered by a few fuzzer tests. The fix itself is fairly low risk as it applies an existing transformation but only earlier and for a corner case. Testing included some CTW testing, jtreg tests with and without -Xcomp. Fix was reviewed by Vladimir and Christian.
16-07-2021

Might be related to JDK-8269575. [~roland] Can you take a look at it?
01-07-2021

ILW = C2 assertion failure (recent regression in JDK 17 b24), only fails with single Java Fuzzer test, disable compilation of affected method = HMM = P2
01-07-2021