The following program causes the Linux JDK 1.1.7v3 to crash with a
SIGFPE. This is because the x86 causes an arithmetic exception when
you divide 0x80000000 by -1; the JVM spec, however, says that the result
of this should be 0x80000000 with NO exception thrown. (The fix is to catch
the SIGFPE and tweak the stack with the right value.)
The IBM JDK 1.1.6 works correctly in this case.
Matt Welsh, [EMAIL PROTECTED]
--
public class divtest {
public static int divfunc(int x, int y) {
return x/y;
}
public static void main(String args[]) {
int i = 0x80000000;
int j = -1;
int k = divfunc(i,j);
System.out.println("Result is "+Integer.toHexString(k));
}
}
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]