JDK-8352681 : C2 compilation hits asserts "must set the initial type just once"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23,24,25
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-03-24
  • Updated: 2025-04-07
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 25
25Unresolved
Related Reports
Causes :  
Description
java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -Xcomp Test_1681.java

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (workspace/open/src/hotspot/share/opto/phaseX.hpp:308), pid=594807, tid=594875
#  assert(_types[n->_idx] == nullptr) failed: must set the initial type just once
#
# JRE version: Java(TM) SE Runtime Environment (25.0+9) (fastdebug build 25-ea+9-LTS-958)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+9-LTS-958, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x15dd618]  PhaseIterGVN::transform(Node*)+0x158

Current CompileTask:
C2:8348  161    b  4       Test_1681::method_double_double_218 (825 bytes)

Stack: [0x0000707bda300000,0x0000707bda400000],  sp=0x0000707bda3fa5d0,  free space=1001k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x15dd618]  PhaseIterGVN::transform(Node*)+0x158  (phaseX.hpp:308)
V  [libjvm.so+0x1424efc]  step_through_mergemem(PhaseGVN*, MergeMemNode*, TypePtr const*, TypePtr const*, outputStream*)+0x9c
V  [libjvm.so+0x14252b4]  MemNode::optimize_simple_memory_chain(Node*, TypeOopPtr const*, Node*, PhaseGVN*)+0x1b4
V  [libjvm.so+0x142583e]  MemNode::optimize_memory_chain(Node*, TypePtr const*, Node*, PhaseGVN*)+0x2e
V  [libjvm.so+0x142678b]  LoadNode::split_through_phi(PhaseGVN*, bool)+0xb4b
V  [libjvm.so+0xc2b1b0]  ConnectionGraph::reduce_phi_on_field_access(Node*, GrowableArray<Node*>&)+0xc0
V  [libjvm.so+0xc2d2ef]  ConnectionGraph::reduce_phi(PhiNode*, GrowableArray<Node*>&, GrowableArray<Node*>&)+0x66f
V  [libjvm.so+0xc30b6b]  ConnectionGraph::split_unique_types(GrowableArray<Node*>&, GrowableArray<ArrayCopyNode*>&, GrowableArray<MergeMemNode*>&, Unique_Node_List&)+0x5fb
V  [libjvm.so+0xc3ba15]  ConnectionGraph::compute_escape()+0x21d5
V  [libjvm.so+0xc3c101]  ConnectionGraph::do_analysis(Compile*, PhaseIterGVN*)+0xe1
V  [libjvm.so+0xa54ae8]  Compile::Optimize()+0x848
V  [libjvm.so+0xa58cdf]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b9f
V  [libjvm.so+0x8a4125]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5
V  [libjvm.so+0xa654a8]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x928
V  [libjvm.so+0xa661e8]  CompileBroker::compiler_thread_loop()+0x528
V  [libjvm.so+0xf2ac3e]  JavaThread::thread_main_inner()+0xee
V  [libjvm.so+0x187f486]  Thread::call_run()+0xb6
V  [libjvm.so+0x15579f8]  thread_native_entry(Thread*)+0x128
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24471 Date: 2025-04-06 04:04:56 +0000
06-04-2025

Sure. Thank your assigning.
26-03-2025

Cesar, would you have time to look at this?
24-03-2025

ILW = Assert during C2 compilation because a node is transformed twice, edge case with generated test, no workaround but disable compilation of affected method = HLM = P3
24-03-2025

This is a regression from JDK-8316991 in JDK 23 b18.
24-03-2025