optimization/6411: Division by zero may not raise exception on Linux/X86
Hans_Boehm@hp.com
Hans_Boehm@hp.com
Mon Apr 22 17:38:00 GMT 2002
>Number: 6411
>Category: optimization
>Synopsis: Division by zero may not raise exception on Linux/X86
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 22 15:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Hans_Boehm@hp.com
>Release: Gcc pre3.1
>Organization:
>Environment:
Linux/X86
>Description:
A division by zero can be eliminated by the gcc optimizer.
This is incorrect for Java code, since it should still
raise an exception. This causes SPECjbb, for example,
to fail with gcj on X86.
This doesn't seem to be an issue on IA64, probably because
a divide routine is always called?
>How-To-Repeat:
[hboehm@hoh ~/java]$ cat divtest2.java
public class divtest2 {
public static void main(String argv[])
{
int a = -10;
int b = 0;
try {
a = a/b;
System.out.println("Failed to throw it");
} catch (java.lang.Exception x) {
System.out.println("Caught it");
}
}
}
[hboehm@hoh ~/java]$ gcj divtest2.java --main=divtest2
[hboehm@hoh ~/java]$ ./a.out
Caught it
[hboehm@hoh ~/java]$ gcj -O2 divtest2.java --main=divtest2
[hboehm@hoh ~/java]$ ./a.out
Failed to throw it
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list