-
Bug
-
Resolution: Fixed
-
P3
-
1.0.2, 1.1, 1.1.1
-
1.1.4
-
x86, sparc
-
solaris_2.4, solaris_2.5, solaris_2.5.1, solaris_9, windows_nt
-
Not verified
Name: laC46010 Date: 01/13/97
The following JCK1.1 tests fail under JDK1.1beta3.2 on x86
causing interpreter core dump due to "SIGFPE 8* arithmetic exception":
EXPR/expr274/expr27401/expr27401.html
EXPR/expr275/expr27501/expr27501.html
EXPR/expr294/expr29401/expr29401.html
Note that these tests failed on NT earlier before fixing the bug #4007660.
See the source for expr27401 below:
-------------------t.java-------------------
// Ident: @(#)expr27401.java 1.5 96/09/02
// Copyright 09/02/96 Sun Microsystems, Inc. All Rights Reserved
package javasoft.sqe.tests.lang.expr274.expr27401;
import java.io.PrintStream;
public class expr27401 {
public static void main(String args[]) {
System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String args[],PrintStream out) {
byte b = (byte) 0x80;
short s = (short) 0x8000;
int i = 0x80000000;
long l = 0x8000000000000000l;
out.println("exception of rounding to zero:");
out.print("i / - 1 == ");
out.println(i / - 1);
out.print("l / - 1 == ");
out.println(l / - 1);
out.print('\n');
out.println("no exception due to binary promotion:");
out.print("b / (byte) - 1 == ");
out.println(b / (byte) - 1);
out.print("s / (short) - 1 == ");
out.println(s / (short) - 1);
return 1;
}
}
--------------------------------------------
Output:
exception of rounding to zero:
SIGFPE 8* arithmetic exception
si_signo [8]: SIGFPE 8* arithmetic exception
si_errno [0]: Error 0
si_code [1]: FPE_INTOVF [addr: 0x8006ea92]
stackbase=8047CE0, stackpointer=8047B08
Full thread dump:
"Finalizer thread" (TID:0x80535418, sys_thread_t:0x8133eda8, state:R) prio=1
"Async Garbage Collector" (TID:0x805353d0, sys_thread_t:0x8131cda8, state:R) prio=1
"Idle thread" (TID:0x80535388, sys_thread_t:0x812fada8, state:R) prio=0
"Clock" (TID:0x80535200, sys_thread_t:0x812d8da8, state:CW) prio=12
"main" (TID:0x805351c0, sys_thread_t:0x8073e60, state:R) prio=5 *current thread*
javasoft.sqe.tests.lang.expr274.expr27401.expr27401.run(expr27401.java:23)
javasoft.sqe.tests.lang.expr274.expr27401.expr27401.main(expr27401.java:13)
Monitor Cache Dump:
Registered Monitor Dump:
Thread queue lock: unowned
Verifier lock: unowned
Name and type hash table lock: unowned
String intern lock: unowned
JNI global reference lock: unowned
BinClass lock: unowned
Class loading lock: unowned
Java stack lock: unowned
Code rewrite lock: unowned
Heap lock: unowned
Has finalization queue lock: unowned
Finalize me queue lock: unowned
test result: Failed. unexpected exit code
======================================================================
From a related, but actually duplicate bug, the same problem happens with
remainder. It's all about getting the 387 in the correct state:
The remainder operation for operands that are integers after binary numeric
promotion produces a result value such that (a / b) * b + (a % b) is equal
to a. This identity holds even in the special case that the dividend is the
negative integer of largest possible magnitude for its type and the divisor
is -1 (the remainder is 0). (#15.16.3)
Nevertheless execution of the following test
import java.io.PrintStream;
public class test
{
public static void main(String args[]) {
int i = 0x80000000;
if (i % - 1 != 0)
System.out.println("fail");
else
System.out.println("pass");
}
}
aborts instead of producing correct output which is:
pass
timothy.lindholm@Eng 1997-01-29
- duplicates
-
JDK-4036752 JCK vm idiv00201 test segfaults on x86
- Closed
-
JDK-1264851 Division of int x80000000 by -1 X86 Solaris
- Closed
-
JDK-4028670 jvm abort on integer division overflow on Solaris x86
- Closed
-
JDK-4028672 jvm abort on integer remainder overflow on x86
- Closed
-
JDK-4042268 x86 misevaluates (Integer.MIN_VALUE/(-1))
- Closed