JDK-8324121 : SIGFPE in PhaseIdealLoop::extract_long_range_checks
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,21,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-01-18
  • Updated: 2024-06-11
  • Resolved: 2024-03-25
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.4Fixed 22.0.2Fixed 23 b16Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
java -Xcomp -XX:CompileCommand=compileonly,Test::test1 -XX:-TieredCompilation Test.java

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0x00007f411f99523c, pid=3536485, tid=3536499
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-internal-2024-01-05-0754282.tobias...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-internal-2024-01-05-0754282.tobias..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x128923c]  PhaseIdealLoop::extract_long_range_checks(IdealLoopTree const*, long, int, PhiNode*, Node_List&)+0x17c
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Current CompileTask:
C2:4257   84    b        Test::test1 (32 bytes)

Stack: [0x00007f40fceb0000,0x00007f40fcfb1000],  sp=0x00007f40fcfaba80,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x128923c]  PhaseIdealLoop::extract_long_range_checks(IdealLoopTree const*, long, int, PhiNode*, Node_List&)+0x17c  (loopnode.cpp:1109)
V  [libjvm.so+0x12a2416]  PhaseIdealLoop::create_loop_nest(IdealLoopTree*, Node_List&)+0x296  (loopnode.cpp:837)
V  [libjvm.so+0x127f658]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x478  (loopTransform.cpp:3645)
V  [libjvm.so+0x127f92e]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x17e  (loopTransform.cpp:3769)
V  [libjvm.so+0x12ac608]  PhaseIdealLoop::build_and_optimize()+0xdf8  (loopnode.cpp:4621)
V  [libjvm.so+0x9e9ab8]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388  (loopnode.hpp:1112)
V  [libjvm.so+0x9e4553]  Compile::Optimize()+0x4c3  (compile.cpp:2385)
V  [libjvm.so+0x9e84d4]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b44  (compile.cpp:860)
V  [libjvm.so+0x83d3c5]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5  (c2compiler.cpp:142)
V  [libjvm.so+0x9f3eec]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c  (compileBroker.cpp:2299)
V  [libjvm.so+0x9f4b78]  CompileBroker::compiler_thread_loop()+0x468  (compileBroker.cpp:1958)
V  [libjvm.so+0xeb988c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:721)
V  [libjvm.so+0x179d2d6]  Thread::call_run()+0xb6  (thread.cpp:220)
V  [libjvm.so+0x14a9ce7]  thread_native_entry(Thread*)+0x127  (os_linux.cpp:789)


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

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle/jdk3/open/src/hotspot/share/utilities/checkedCast.hpp:41), pid=3536591, tid=3536607
#  assert(static_cast<T1>(result) == thing) failed: must be
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (fastdebug build 23-internal-2024-01-05-0754282.tobias...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-internal-2024-01-05-0754282.tobias..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12a1b70]  PhaseIdealLoop::transform_long_range_checks(int, Node_List const&, Node*, Node*, Node*, Node*, LoopNode*)+0xcc0
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Current CompileTask:
C2:4161   88    b        Test::test2 (32 bytes)

Stack: [0x00007f8edd335000,0x00007f8edd436000],  sp=0x00007f8edd4309e0,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12a1b70]  PhaseIdealLoop::transform_long_range_checks(int, Node_List const&, Node*, Node*, Node*, Node*, LoopNode*)+0xcc0  (checkedCast.hpp:41)
V  [libjvm.so+0x12a317c]  PhaseIdealLoop::create_loop_nest(IdealLoopTree*, Node_List&)+0xffc  (loopnode.cpp:1056)
V  [libjvm.so+0x127f658]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x478  (loopTransform.cpp:3645)
V  [libjvm.so+0x127f92e]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x17e  (loopTransform.cpp:3769)
V  [libjvm.so+0x12ac608]  PhaseIdealLoop::build_and_optimize()+0xdf8  (loopnode.cpp:4621)
V  [libjvm.so+0x9e9ab8]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388  (loopnode.hpp:1112)
V  [libjvm.so+0x9e4553]  Compile::Optimize()+0x4c3  (compile.cpp:2385)
V  [libjvm.so+0x9e84d4]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b44  (compile.cpp:860)
V  [libjvm.so+0x83d3c5]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5  (c2compiler.cpp:142)
V  [libjvm.so+0x9f3eec]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c  (compileBroker.cpp:2299)
V  [libjvm.so+0x9f4b78]  CompileBroker::compiler_thread_loop()+0x468  (compileBroker.cpp:1958)
V  [libjvm.so+0xeb988c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:721)
V  [libjvm.so+0x179d2d6]  Thread::call_run()+0xb6  (thread.cpp:220)
V  [libjvm.so+0x14a9ce7]  thread_native_entry(Thread*)+0x127  (os_linux.cpp:789)

Looks like the issue was introduced by JDK-8278296 in JDK 19 b13. I recently found and filed another, potentially related, issue with long loop opts (JDK-8323972).
Comments
[jdk22u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to improve C2 reliability against overflows. Applies cleanly. GHA tests pass. The new regression test unfortunately passes even without the fix. Usual risk for C2 changes, but the change looks simple enough, and there is only a tiny bugtail: JDK-8329163.
22-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk22u/pull/159 Date: 2024-04-22 09:28:14 +0000
22-04-2024

[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to improve C2 reliability against overflows. Applies cleanly. All tests pass, including aggressive compiler testing. The new regression test unfortunately passes even without the fix. Usual risk for C2 changes, but the change looks simple enough, and there is no bugtail.
16-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/488 Date: 2024-04-11 06:45:44 +0000
11-04-2024

Changeset: cb2a6713 Author: Roland Westrelin <roland@openjdk.org> Date: 2024-03-25 12:55:08 +0000 URL: https://git.openjdk.org/jdk/commit/cb2a6713596548d76c03912709656172b0bbcc76
25-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18397 Date: 2024-03-20 12:17:03 +0000
20-03-2024

Paging [~roland].
18-01-2024

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