java/3097: Divide by zero does not work with long

aneesha@hpl.hp.com aneesha@hpl.hp.com
Fri Jun 8 16:56:00 GMT 2001


>Number:         3097
>Category:       java
>Synopsis:       Divide by zero does not work with long
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 08 16:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Aneesh Aggarwal
>Release:        gcc version 3.1 20010601 (experimental)
>Organization:
>Environment:
Linux 2.4 on x86
>Description:
On division by zero for a long, NO exception is thrown.
The program crashes.
It, however, works correctly for int.
>How-To-Repeat:
public class div_test {
     public static void main(String [] args) {
        long a = 10, b = 0;
        try {
           a = a/b;
        }
        catch (java.lang.Exception e) {
           System.out.println("Div by zero working");
        }
     }
   }
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list