This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Divide by zero does not throw exception for longs


>>>>> "Aneesh" == Aneesh Aggarwal <aneesha@granite.hpl.hp.com> writes:

Aneesh> It works correctly for
Aneesh> libjava/testsuite/libjava.lang/Divide_1.java. In
Aneesh> Divide_1.java, if instead of

Aneesh> long a = 8000;
Aneesh> long b = 0;
Aneesh> long c = a/b;

I tried the appended program and it worked for me.
I'm using gcc3 that I updated and rebuilt today.
In particular I rebuilt libgcj from scratch.

    creche. gcj -O3 --main=foo -o F foo.java  -Wl,-rpath,/x1/gcc3/install/lib
    creche. ./F
    Exception in thread "main" java.lang.ArithmeticException: / by zero
       at 0x401497ca: _Jv_ThrowSignal (/x1/gcc3/install/lib/libgcj.so.2)
       at 0x4014994d: _Jv_ThrowSignal (/x1/gcc3/install/lib/libgcj.so.2)
       at 0x08048bad: ?? (/usr/src/bs/BUILD/glibc-2.1.3/csu/init.c:0)
       at 0x401677a0: gnu.gcj.runtime.FirstThread.run() (/x1/gcc3/install/lib/libgcj.so.2)
       at 0x401754e7: java.lang.Thread.run_(java.lang.Object) (/x1/gcc3/install/lib/libgcj.so.2)
       at 0x402855bf: _Jv_ThreadSetPriority(_Jv_Thread_t, int) (/x1/gcc3/install/lib/libgcj.so.2)
       at 0x404b472c: GC_start_routine (/x1/gcc3/install/lib/libgcjgc.so.1)
       at 0x404cdb85: pthread_detach (/lib/libpthread.so.0)
       at 0x4059f16a: __clone (/lib/libc.so.6)


Does this fail for anybody else?

I understood that Andrew made it fail.  But why doesn't it fail for
me?

I'm doing this on my x86 Red Hat Linux 6.2 box.

Tom

public class foo 
{
  public static void main (String[] args)
  {
    long a = 8000;
    long b = 0;
    long c = a/b;

    System.out.println (c); 
  }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]