JDK-8323154 : C2: assert(cmp != nullptr && cmp->Opcode() == Op_Cmp(bt)) failed: no exit test
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18,21,22,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-01-08
  • Updated: 2024-03-04
  • Resolved: 2024-01-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 21 JDK 22 JDK 23
21.0.3Fixed 22.0.1Fixed 23 b07Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The attached test fails with the following assert. This is the very same problem as reported with JDK-8314191 but with long counted loops and a different manifestation.  The follow-up fix of JDK-8314191 wrongly checks against CountedLoopNodes instead of `LongCountedLoopNodes in the newly added is_cloop_condition(). This should be changed to check against BaseCountedLoopNodes accordingly.

To reproduce:

$ java -Xcomp -XX:CompileCommand=compileonly,Test*::test TestLongMinValue.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/afbc6042-3a24-4198-9369-18c663a3f74c-S38629/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/38e9bdcc-eebc-4966-866e-e4e5ee117550/runs/849e2004-3d12-46ef-9189-ddce518a1214/workspace/open/src/hotspot/share/opto/loopnode.cpp:1459), pid=516707, tid=516721
#  assert(cmp != nullptr && cmp->Opcode() == Op_Cmp(bt)) failed: no exit test
#
# JRE version: Java(TM) SE Runtime Environment (23.0+3) (fastdebug build 23-ea+3-133)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-ea+3-133, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1289a2c]  PhaseIdealLoop::check_counted_loop_shape(IdealLoopTree*, Node*, BasicType)+0x53c
.........
Command Line: -XX:+TraceLoopOpts -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,Test*::test --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher TestLongMinValue.java
.........
Current CompileTask:
C2:975   83    b        TestLongMinValue::test (34 bytes)

Stack: [0x00007f1da8e00000,0x00007f1da8f00000],  sp=0x00007f1da8efa9d0,  free space=1002k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1289a2c]  PhaseIdealLoop::check_counted_loop_shape(IdealLoopTree*, Node*, BasicType)+0x53c  (loopnode.cpp:1459)
V  [libjvm.so+0x12a242c]  PhaseIdealLoop::create_loop_nest(IdealLoopTree*, Node_List&)+0xbc
V  [libjvm.so+0x127fa78]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x478
V  [libjvm.so+0x127fd4e]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x17e
V  [libjvm.so+0x12ac7f8]  PhaseIdealLoop::build_and_optimize()+0xdf8
V  [libjvm.so+0x9f3248]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388
V  [libjvm.so+0x9ee356]  Compile::Optimize()+0xb96
V  [libjvm.so+0x9f1d7b]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1beb
V  [libjvm.so+0x83e277]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e7
V  [libjvm.so+0x9fd33c]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c
V  [libjvm.so+0x9fdfc8]  CompileBroker::compiler_thread_loop()+0x468
V  [libjvm.so+0xeba63c]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x179fc46]  Thread::call_run()+0xb6
V  [libjvm.so+0x14a9ef7]  thread_native_entry(Thread*)+0x127

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk22u/pull/73 Date: 2024-02-28 06:42:56 +0000
28-02-2024

Fix Request (JDK 22u) Fixes an assert during C2 compilation. The fix was already backported to JDK 21u. The fix is low risk because it only affects a single check. Tested with tier1,tier2,tier3,hs-comp-stress,hs-precheckin-comp. Applies cleanly.
28-02-2024

[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to fix another C2 corner case; introduced by JDK-8316719, which is in 21.0.2. Applies cleanly. Tests pass.
22-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/201 Date: 2024-01-22 08:52:57 +0000
22-01-2024

Changeset: 6997bfc6 Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2024-01-19 15:49:02 +0000 URL: https://git.openjdk.org/jdk/commit/6997bfc68def7f80fbf6a7486a4b9f61225fc471
19-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17459 Date: 2024-01-17 07:44:28 +0000
17-01-2024

ILW = Same as JDK-8314191 = P3
08-01-2024