JDK-8291775 : C2: assert(r != __null && r->is_Region()) failed: this phi must have a region
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,18,19,20
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2022-07-27
  • Updated: 2025-06-03
  • Resolved: 2022-08-18
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 19 JDK 20
17.0.6-oracleFixed 19.0.2Fixed 20 b12Fixed
Related Reports
Causes :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
OS: Ubuntu18.04
$ java -version
openjdk version "20-internal" 2023-03-21
OpenJDK Runtime Environment (fastdebug build 20-internal-adhoc.root.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 20-internal-adhoc.root.jdk, mixed mode, sharing)

A DESCRIPTION OF THE PROBLEM :
This configuration fails:

$ CONF=linux-x86_64-server-fastdebug make test TEST=compiler/c2/Test7179138_1.java TEST_VM_OPTS="-XX:+AlwaysIncrementalInline"

# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/cfgnode.cpp:1946
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/root/jdk/src/hotspot/share/opto/cfgnode.cpp:1946), pid=24389, tid=24404
#  assert(r != __null && r->is_Region()) failed: this phi must have a region
#
# JRE version: OpenJDK Runtime Environment (20.0) (fastdebug build 20-internal-adhoc.root.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 20-internal-adhoc.root.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8af375]  PhiNode::Ideal(PhaseGVN*, bool)+0x85

Besides, the following cases failed with "-XX:+AlwaysIncrementalInline":
compiler/ciReplay/TestInliningProtectionDomain.java 
compiler/intrinsics/klass/CastNullCheckDroppingsTest.java 
compiler/uncommontrap/Decompile.java 



Comments
Fix request [17u] I backport this for parity with 17.0.6-oracle. Small fix to C2, low risk. Clean backport. Test passes. SAP nightly testing passed.
01-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/760 Date: 2022-09-30 12:58:10 +0000
30-09-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk19u/pull/33 Date: 2022-09-22 13:29:00 +0000
22-09-2022

Fix Request (JDK 19u) Fixes an assert during C2 compilation. The fix is low risk and applies cleanly. Already tested and backported to Oracle JDK 17u.
22-09-2022

Changeset: 32d675ca Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2022-08-18 07:35:14 +0000 URL: https://git.openjdk.org/jdk/commit/32d675ca607d341ca3428efc32e212701775e3c6
18-08-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9878 Date: 2022-08-15 12:42:04 +0000
15-08-2022

Assert is only hit with Test7179138_1.java. The other mentioned tests are assertion failures which seem to be test failures. These should be fixed as part of JDK-8256540.
09-08-2022

ILW = Assert during C2 compilation, reproducible with single test and stress options, no workaround but disable compilation of affected method = HLM = P3
03-08-2022

Issue is reproduced. Test7179138_1.java is resulting in crash with Problematic frame: # V [libjvm.so+0x961edc] PhiNode::Ideal(PhaseGVN*, bool)+0x5c when "-XX:+AlwaysIncrementalInline" is used. (hs_err_pid1968.log and replay_pid1968.log are attached) OS : Ubuntu 18.04 JDK 20 fastdebug internal build :Fail ILW: MMM = P3 Moving it to dev team for further analysis
03-08-2022

I can reproduce this since JDK 17, probably related to JDK-8271341. With JDK 17 and 18, a different assert is triggered though: # Internal Error (/workspace/open/src/hotspot/share/opto/cfgnode.hpp:179), pid=3019922, tid=3019935 # Error: assert(!r || r->is_Region()) failed # # JRE version: Java(TM) SE Runtime Environment (17.0.5+3) (fastdebug build 17.0.5-ea+3-LTS-161) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17.0.5-ea+3-LTS-161, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x147e60f] MergeMemNode::Ideal(PhaseGVN*, bool)+0x80f Current CompileTask: C2: 2076 393 % b Test::main @ 38 (214 bytes) Stack: [0x00007efff6734000,0x00007efff6835000], sp=0x00007efff682f8d0, free space=1006k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x147e60f] MergeMemNode::Ideal(PhaseGVN*, bool)+0x80f V [libjvm.so+0x16402ae] PhaseGVN::transform_no_reclaim(Node*)+0x5e V [libjvm.so+0x1470bb4] step_through_mergemem(PhaseGVN*, MergeMemNode*, TypePtr const*, TypePtr const*, outputStream*)+0xa4 V [libjvm.so+0x14726a8] MemNode::Ideal_common(PhaseGVN*, bool)+0x498 V [libjvm.so+0x14789b5] LoadNode::Ideal(PhaseGVN*, bool)+0x25 V [libjvm.so+0x16402ae] PhaseGVN::transform_no_reclaim(Node*)+0x5e V [libjvm.so+0x1466fbd] LoadNode::make(PhaseGVN&, Node*, Node*, Node*, TypePtr const*, Type const*, BasicType, MemNode::MemOrd, LoadNode::ControlDependency, bool, bool, bool, bool, unsigned char)+0x96d V [libjvm.so+0xd81038] GraphKit::make_load(Node*, Node*, Type const*, BasicType, int, MemNode::MemOrd, LoadNode::ControlDependency, bool, bool, bool, bool, unsigned char)+0xb8 V [libjvm.so+0x67966a] BarrierSetC2::load_at_resolved(C2Access&, Type const*) const+0x13a V [libjvm.so+0xc26b8f] G1BarrierSetC2::load_at_resolved(C2Access&, Type const*) const+0xcf V [libjvm.so+0x677dbd] BarrierSetC2::load_at(C2Access&, Type const*) const+0xed V [libjvm.so+0xd94757] GraphKit::load_String_value(Node*, bool)+0x217 V [libjvm.so+0xd947f3] GraphKit::load_String_length(Node*, bool)+0x23 V [libjvm.so+0x17cce2d] PhaseStringOpts::replace_string_concat(StringConcat*)+0x14bd V [libjvm.so+0x17cfe4f] PhaseStringOpts::PhaseStringOpts(PhaseGVN*, Unique_Node_List*)+0x66f V [libjvm.so+0xa252ec] Compile::inline_string_calls(bool)+0x3bc V [libjvm.so+0xa38ac4] Compile::inline_incrementally(PhaseIterGVN&)+0x364 V [libjvm.so+0xa39349] Compile::Optimize()+0x3e9 V [libjvm.so+0xa3bffe] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x163e V [libjvm.so+0x84dad6] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646 V [libjvm.so+0xa4c04a] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb7a V [libjvm.so+0xa4cd48] CompileBroker::compiler_thread_loop()+0x598 V [libjvm.so+0x18ebf56] JavaThread::thread_main_inner()+0x256 V [libjvm.so+0x18f20f0] Thread::call_run()+0x100 V [libjvm.so+0x15b6664] thread_native_entry(Thread*)+0x104
03-08-2022