JDK-8315377 : C2: assert(u->find_out_with(Op_AddP) == nullptr) failed: more than 2 chained AddP nodes?
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-30
  • Updated: 2023-10-06
  • Resolved: 2023-09-06
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 21 JDK 22
17.0.10-oracleFixed 21.0.2Fixed 22 b14Fixed
Related Reports
Relates :  
Relates :  
Description
The attached Java Fuzzer test starts to fail after JDK-8303466 (seems unrelated and must have just revealed an existing issue):

To reproduce:

$ java -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,Test::* Test.java
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Reduced::test 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-S141865/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/8a11c2a6-dc3b-42a8-a1bf-5f4afa468e45/runs/9fc53209-cfb4-45ef-bad1-2b89080d866c/workspace/open/src/hotspot/share/opto/loopopts.cpp:1714), pid=3134144, tid=3134158
#  assert(u->find_out_with(Op_AddP) == nullptr) failed: more than 2 chained AddP nodes?
#
# JRE version: Java(TM) SE Runtime Environment (22.0) (fastdebug build 22-internal-2023-08-25-1459578.christian.hagedorn.jdk)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-internal-2023-08-25-1459578.christian.hagedorn.jdk, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12aeb03]  PhaseIdealLoop::try_sink_out_of_loop(Node*)+0xc53
..........
Command Line: -XX:CompileCommand=quiet -XX:-TieredCompilation -Xcomp -XX:CompileOnly=Test::* Test
..........
Current CompileTask:
C2:    234    6   !b        Test::lMeth1 (341 bytes)

Stack: [0x00007f76cd233000,0x00007f76cd333000],  sp=0x00007f76cd32dc10,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12aeb03]  PhaseIdealLoop::try_sink_out_of_loop(Node*)+0xc53  (loopopts.cpp:1714)
V  [libjvm.so+0x12aed57]  PhaseIdealLoop::split_if_with_blocks_post(Node*)+0xe7
V  [libjvm.so+0x12af677]  PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x97
V  [libjvm.so+0x12a34ef]  PhaseIdealLoop::build_and_optimize()+0xf9f
V  [libjvm.so+0x9ef5d9]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x3b9
V  [libjvm.so+0x9eab1f]  Compile::Optimize()+0xdaf
V  [libjvm.so+0x9ee3a0]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1bb0
V  [libjvm.so+0x84949b]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x13b
V  [libjvm.so+0x9fa2b7]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x977
V  [libjvm.so+0x9faff8]  CompileBroker::compiler_thread_loop()+0x5f8
V  [libjvm.so+0xeb65cc]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x17a09fa]  Thread::call_run()+0xba
V  [libjvm.so+0x149fe9a]  thread_native_entry(Thread*)+0x12a
Comments
Fix request [17u] I backport this for parity with 17.0.10-oracle. Typical risk of a C2 fix. Medium risk. Trivial resolve needed. Test passes, but passes also without the fix. SAP nightly testing passed.
05-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1829 Date: 2023-10-04 08:22:06 +0000
04-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/218 Date: 2023-10-02 09:59:09 +0000
02-10-2023

Fix request [21u] I backport this for parity with 17.0.10-oracle. Typical risk of a C2 fix, but as it fixes an obvious, well reproducible issue we should definitely backport this. Clean backport. Test fails without the fix and passes with it.
02-10-2023

Changeset: ba1a4639 Author: Roland Westrelin <roland@openjdk.org> Date: 2023-09-06 07:25:22 +0000 URL: https://git.openjdk.org/jdk/commit/ba1a46392f0b9c77c64278f82513aaf51f5c9b1b
06-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15562 Date: 2023-09-04 15:51:34 +0000
04-09-2023

Hi [~roland], would you like to have a look?
30-08-2023

ILW = Assertion failure when trying to sink a node in Split If, single Java Fuzzer test, use -XX:-SplitIfBlocks = HLM = P3
30-08-2023