JDK-6997311 : SIGFPE in new long division asm code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs20
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: x86
  • Submitted: 2010-11-03
  • Updated: 2015-12-03
  • Resolved: 2011-04-23
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 6 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Related Reports
Duplicate :  
Relates :  
Description
Next Nightly tests failed with SIGFPE after changes added for 6987135.

java/util/Arrays/ArrayObjectMethods.java
regression/jit/4139729/Calendar/CalendarLimitTest
regression/jit/4139729/Calendar/CalendarTest
regression/jit/4139729/Calendar/Limit
regression/jit/4139731/Date/DateTest
regression/jit/4139904/TimeZone/TimeZoneBoundaryTest

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0xf97bc8fc, pid=25762, tid=2
#
# JRE version: 7.0
# Java VM: OpenJDK Server VM (20.0-b01-201011021612.kvn.6987135-fastdebug compiled mode solaris-x86 )
# Problematic frame:
# J  java.lang.Long.getChars(JI[C)V
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x08099c00):  JavaThread "main" [_thread_in_Java, id=2, stack(0xfc74f000,0xfc79f000)]

siginfo:si_signo=SIGFPE: si_errno=0, si_code=1 (FPE_INTDIV), si_addr=0xf97bc8fc;; 

Registers:
EAX=0xdd9ac67f, EBX=0xee963ac0, ECX=0x00000064, EDX=0x00000063
ESP=0xfc79e110, EBP=0x00000001, ESI=0x0000003b, EDI=0x000000c7
EIP=0xf97bc8fc, EFLAGS=0x00010256

Top of Stack: (sp=0xfc79e110)
0xfc79e110:   0000003c 0000005a 00000004 d5642f10
0xfc79e120:   eea09110 ee9639e8 ee963ac0 00000000
0xfc79e130:   0000005a eea09110 0000003c f97bad18
0xfc79e140:   dd9ac67f 000000c7 eea08d98 00000000
0xfc79e150:   00000000 00000000 08099c00 f980f8bc
0xfc79e160:   dd9ac67f 000000c7 eea08d80 eea08d98
0xfc79e170:   eea08fc8 eea08f88 d563c4f8 000000c7
0xfc79e180:   eea08d80 f980f1c0 08099c00 f987208c 

Instructions: (pc=0xf97bc8fc)
0xf97bc8dc:   8b 34 24 4e 8b 44 24 30 8b 54 24 34 b9 64 00 00
0xf97bc8ec:   00 3b ca 77 12 8b e8 8b c2 c1 fa 1f f7 f9 87 c5
0xf97bc8fc:   f7 f9 99 03 d5 eb 04 f7 f9 33 d2 8b c8 8b da 0f
0xf97bc90c:   a4 cb 02 c1 e1 02 89 4c 24 08 89 5c 24 0c 8b c8 
;; f97bc8ec 00 3b                   add    %bh,(%ebx)
;; f97bc8ee ca 77 12                lret   $0x1277
;; f97bc8f1 8b e8                   mov    %eax,%ebp
;; f97bc8f3 8b c2                   mov    %edx,%eax
;; f97bc8f5 c1 fa 1f                sar    $0x1f,%edx
;; f97bc8f8 f7 f9                   idiv   %ecx
;; f97bc8fa 87 c5                   xchg   %eax,%ebp
;; ---------------
;; f97bc8fc f7 f9                   idiv   %ecx
;; f97bc8fe 99                      cltd   
;; f97bc8ff 03 d5                   add    %ebp,%edx
;; f97bc901 eb 04                   jmp    0xf97bc907
;; f97bc903 f7 f9                   idiv   %ecx
;; f97bc905 33 d2                   xor    %edx,%edx
;; f97bc907 8b c8                   mov    %eax,%ecx
;; f97bc909 8b da                   mov    %edx,%ebx
;; f97bc90b 0f a4 cb 02             shld   $0x2,%ecx,%ebx
;; f97bc90f c1 e1 02                shl    $0x2,%ecx
;; f97bc912 89 4c 24 08             mov    %ecx,0x8(%esp,1)
;; f97bc916 89 5c 24 0c             mov    %ebx,0xc(%esp,1)
;; f97bc91a 8b c8                   mov    %eax,%ecx

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/hotspot/rev/2fe998383789
04-12-2010

PUBLIC COMMENTS Regression after changes added for 6987135. IDIV instruction throws SIGFPE if sign of result does not fit into 32 bit. I have to use unsigned DIV instruction and convert negative dividend to positive and result back. So more code. Added missing cast to long in 6603011/Test.java which prevented me to catch this situation during work on 6987135. Added additional verification output for failure (the same as for int testing).
09-11-2010

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/2fe998383789
07-11-2010

EVALUATION IDIV instruction throws SIGFPE if result of division does not fit into 32 bit. This includes the case when 32 bit result has different sign (high bit is set) than dividend. This is the bug case. It seems, I have to use unsigned DIV instruction.
03-11-2010