This is the mail archive of the java-discuss@sourceware.cygnus.com 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: SIGFPE -> ArithmeticException ?


Andrew Haley wrote:

> Unfortunately, I can't duplicate your problem.  This *is* something we
> regularly test.
>
> Please run the program under gdb.  When the SIGFPE occurs, put a
> breakpoint on 'catch-fpe'.  When you get to 'catch-fpe', print a
> backtrace and mail it to me.

Hi Andrew,

Here's a log of my gdb session. It doesnt seem particularly interesting:

[bryce@reason tests]$ gdb ./divbyzero
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i586-pc-linux"...
(gdb) run
Starting program: /home/bryce/projects/tests/./divbyzero
[New Thread 14783]
[New Thread 14782]
[New Thread 14784]

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 14784]

Program received signal SIGFPE, Arithmetic exception.
0x804ad5d in main__9DivByZeroPt6JArray1ZPQ34java4lang6String
(args=@806eff0)
    at DivByZero.java:9
9              int c = a/b;
Current language:  auto; currently java
(gdb) break catch_fpe
Breakpoint 1 at 0x4008d456: file ../../../libjava/prims.cc, line 76.
(gdb) c
Continuing.

Breakpoint 1, catch_fpe (_dummy=8) at ../../../libjava/prims.cc:76
76        _Jv_Throw (arithexception);
Current language:  auto; currently c++
(gdb) bt
#0  catch_fpe (_dummy=8) at ../../../libjava/prims.cc:76
(gdb)


The "aborted" seems to be showing up at some point during or after the
_Jv_Throw call.

Here's another case where exceptions don't seem to be working:

public class NullPointer
{
  public static void main(String args[])
    {
      try
        {
          String f = null;
          f.toString();
        }
       catch (Exception x)
         {
           System.out.println(x);
         }
    }
}

Under a JVM this produces a NullPointerException, but gcj doesn't seem to
mind it (!)

I can even pass the result of f.toString() to System.out.println() and get
"null" printed. Weird.

regards

  [ bryce ]



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