JDK-8309902 : C2: assert(false) failed: Bad graph detected in build_loop_late after JDK-8305189
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-13
  • Updated: 2024-02-08
  • Resolved: 2023-06-30
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 21 JDK 22 Other
21Fixed 22 b05Fixed naResolved
Related Reports
Relates :  
Relates :  
Description
The following Java Fuzzer test fails after JDK-8305189 with the following assertion:

To reproduce:
$ java -Xcomp -XX:CompileCommand=compileonly,Test::* Test.java
$ java -Xcomp -XX:CompileCommand=compileonly,Reduced::* Reduced.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S9638/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/7cab5968-cfac-4917-b50c-ee11433deb3c/runs/89e28e37-02bc-4ad0-8809-7a3c3140d816/workspace/open/src/hotspot/share/opto/loopnode.cpp:6101), pid=31952, tid=31967
#  assert(false) failed: Bad graph detected in build_loop_late
#
# JRE version: Java(TM) SE Runtime Environment (21.0+26) (fastdebug build 21-ea+26-LTS-2328)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-ea+26-LTS-2328, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12953f8]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x9a8
...........
Command Line: -Xmx1G -Xcomp -Xbatch -XX:CompileOnly=Test -XX:CompileCommand=quiet -XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/opt/mach5/mesos/work_dir/jib-master/install/jdk/20/36/bundles/linux-x64/jdk-20_linux-x64_bin.tar.gz/jdk-20 -Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S9617/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/22e17643-863f-4109-a641-efb37041dde2/runs/40615183-9cee-43d6-a5bd-08247939f04a/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_javafuzzer_BigTest_java/tmp Test
..........
Current CompileTask:
C2:    517    8   !b  4       Test::iMeth (318 bytes)

Stack: [0x00007f33d0963000,0x00007f33d0a64000],  sp=0x00007f33d0a5ed30,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12953f8]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x9a8  (loopnode.cpp:6101)
V  [libjvm.so+0x129552d]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xbd  (loopnode.cpp:6004)
V  [libjvm.so+0x1295e75]  PhaseIdealLoop::build_and_optimize()+0x635  (loopnode.cpp:4444)
V  [libjvm.so+0x9f2939]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x3b9  (loopnode.hpp:1124)
V  [libjvm.so+0x9ef4a7]  Compile::Optimize()+0xe97  (compile.cpp:2156)
V  [libjvm.so+0x9f16d6]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b96  (compile.cpp:842)
V  [libjvm.so+0x84b3e4]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x3c4  (c2compiler.cpp:118)
V  [libjvm.so+0x9fd5e0]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa00  (compileBroker.cpp:2265)
V  [libjvm.so+0x9fe468]  CompileBroker::compiler_thread_loop()+0x618  (compileBroker.cpp:1944)
V  [libjvm.so+0xeb651c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:719)
V  [libjvm.so+0x1795d7a]  Thread::call_run()+0xba  (thread.cpp:217)
V  [libjvm.so+0x149623c]  thread_native_entry(Thread*)+0x11c  (os_linux.cpp:778)
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk21/pull/83 Date: 2023-06-30 07:07:30 +0000
30-06-2023

Fix was pushed while main issue was targeted to '21'. Reset the main issue to fixed in '22' and copied the Robo Duke entry here.
30-06-2023

Changeset: 26efff75 Author: Roland Westrelin <roland@openjdk.org> Date: 2023-06-29 15:05:49 +0000 URL: https://git.openjdk.org/jdk/commit/26efff758684b9c5615fb3b087538d713e6eca10
30-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14672 Date: 2023-06-27 10:02:37 +0000
27-06-2023

[~roland] Can you have a look at it?
13-06-2023

ILW = Bad graph assertion, single Java fuzzer test, disable compilation of affected method = HLM = P3
13-06-2023