JDK-8259227 : C2 crashes with SIGFPE due to a division that floats above its zero check
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-05
  • Updated: 2024-07-18
  • Resolved: 2021-01-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 11 JDK 16 JDK 17
11.0.12-oracleFixed 16 b32Fixed 17Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The attached fuzzer test fails with SIGFPE:

To reproduce:
java -Xcomp -XX:CompileOnly=Test  -XX:-TieredCompilation -XX:+StressGCM Test.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0x00007f3958a87a73, pid=12682, tid=12683
#
# JRE version: Java(TM) SE Runtime Environment (16.0+30) (fastdebug build 16-ea+30-2130)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 16-ea+30-2130, compiled mode, sharing, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# J 3 c2 Test.mainTest([Ljava/lang/String;)V (613 bytes) @ 0x00007f3958a87a73 [0x00007f3958a87400+0x0000000000000673]
...........
Command Line: -Xmx1G -Xcomp -Xbatch -XX:CompileOnly=Test -XX:CompileCommand=quiet -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:StressSeed=917280111 Test
...........
Current thread (0x00007f3954026570):  JavaThread "main" [_thread_in_Java, id=12683, stack(0x00007f395ecd8000,0x00007f395edd9000)]

Stack: [0x00007f395ecd8000,0x00007f395edd9000],  sp=0x00007f395edd78b0,  free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 3 c2 Test.mainTest([Ljava/lang/String;)V (613 bytes) @ 0x00007f3958a87a73 [0x00007f3958a87400+0x0000000000000673]
J 2 c2 Test.main([Ljava/lang/String;)V (45 bytes) @ 0x00007f3958a868dc [0x00007f3958a86720+0x00000000000001bc]
v  ~StubRoutines::call_stub
V  [libjvm.so+0xe5e795]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x595
V  [libjvm.so+0xfa53a9]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .constprop.1]+0x369
V  [libjvm.so+0xfab16d]  jni_CallStaticVoidMethod+0x20d
C  [libjli.so+0x4724]  JavaMain+0xd34
C  [libjli.so+0x7c89]  ThreadJavaMain+0x9


siginfo: si_signo: 8 (SIGFPE), si_code: 1 (FPE_INTDIV), si_addr: 0x00007f3958a87a73

Comments
Fix Request (11u) Should get backported for parity with 11.0.12-oracle (together with JDK-8257822 and other follow-up fixes). This one applies cleanly, but I had to change the jtreg tests. Review thread: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-March/005410.html
22-03-2021

Changeset: c1fb5216 Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2021-01-07 15:02:45 +0000 URL: https://git.openjdk.java.net/jdk16/commit/c1fb5216
07-01-2021

This issue is very similar to the one fixed in JDK-8257822. I think we also need to apply the fix from JDK-8257822 to IfNode::dominated_by to fix this failure.
05-01-2021

It starts to fail after JDK-8257822 but I think it just reveals an additional problem.
05-01-2021

[~chagedorn] is this a regression in JDK 16? ILW = Same as JDK-8257822 = P3
05-01-2021