JDK-8323972 : C2 compilation fails with assert(!x->as_Loop()->is_loop_nest_inner_loop()) failed: loop was transformed
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17,21,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-01-17
  • Updated: 2024-06-14
  • Resolved: 2024-03-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 23
21.0.5-oracleFixed 23 b15Fixed
Related Reports
Relates :  
Description
Attached Test.java fails since JDK-8256655 in JDK 16 b27.

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

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10108/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/64ecc42e-c311-4cbc-9f8c-cdb54670fe43/runs/6ce1ca2a-f2b6-4d79-a919-946bcfa599e7/workspace/open/src/hotspot/share/opto/loopnode.cpp:1812), pid=3454163, tid=3454177
#  assert(!x->as_Loop()->is_loop_nest_inner_loop()) failed: loop was transformed
#
# JRE version: Java(TM) SE Runtime Environment (23.0+4) (fastdebug build 23-ea+4-173)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-ea+4-173, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:

Current CompileTask:
C2:2991   83    b        Test::test (22 bytes)

Stack: [0x00007fc08a9a9000,0x00007fc08aaaa000],  sp=0x00007fc08aaa4a00,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12a64c2]  PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0x28e2  (loopnode.cpp:1812)
V  [libjvm.so+0x12a66e0]  IdealLoopTree::counted_loop(PhaseIdealLoop*)+0x40
V  [libjvm.so+0x12a6752]  IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
V  [libjvm.so+0x12a6752]  IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
V  [libjvm.so+0x12ab537]  PhaseIdealLoop::build_and_optimize()+0x867
V  [libjvm.so+0x9f19d8]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388
V  [libjvm.so+0x9ecae6]  Compile::Optimize()+0xb96
V  [libjvm.so+0x9f050b]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1beb
V  [libjvm.so+0x83dc57]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e7
V  [libjvm.so+0x9fbacc]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c
V  [libjvm.so+0x9fc758]  CompileBroker::compiler_thread_loop()+0x468
V  [libjvm.so+0xeb99ec]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x179ea66]  Thread::call_run()+0xb6
V  [libjvm.so+0x14a92e7]  thread_native_entry(Thread*)+0x127
Comments
[jdk21u-fix-request] Approval Request from Martin Should get backported for parity with 21.0.5-oracle. Applies cleanly and tier 1-4 have passed.
14-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/717 Date: 2024-06-13 15:14:08 +0000
13-06-2024

Changeset: e1b0af29 Author: Roland Westrelin <roland@openjdk.org> Date: 2024-03-19 07:56:53 +0000 URL: https://git.openjdk.org/jdk/commit/e1b0af29e47b46879defce1fc44c30d4d50d0c31
19-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17965 Date: 2024-02-22 14:36:52 +0000
22-02-2024

Paging [~roland].
17-01-2024

ILW = Assert during C2 compilation, edge case but easy to reproduce, no workaround but disable compilation of affected method or loop opts = HLM = P3
17-01-2024