Exception handling bug in latest egcs snapshot

Tim Wilkinson tim@transvirtual.com
Thu Sep 10 11:12:00 GMT 1998


The following code aborts under egcs-19980906 but works fine under
gcc-2.8.1.  Both are running on Redhat Linux 5.0 (i386).

x.cc:

#include <iostream.h>

class bang {};

func()
{
        throw bang();
}

main()
{
        try {
                func();
        }
        catch (bang) {
                cout << "BANG\n";
        }
}

For gcc-2.8.1 I compiled this with "g++ -fhandle-exceptions x.cc" and
when run it printed "BANG" as one would expect.  On egcs-19980906
compiled with "g++ -fexceptions x.cc" if aborts.  The stack trace looks
like this:

(gdb) run
Starting program: /home/tim/a.out

Program received signal SIGABRT, Aborted.
0x4007c131 in __kill ()
(gdb) where
#0  0x4007c131 in __kill ()
#1  0x4007bf4f in raise (sig=6) at ../sysdeps/posix/raise.c:28
#2  0x4007d16f in abort () at ../sysdeps/generic/abort.c:134
#3  0x8049c95 in copy_reg (reg=16, udata=0xbffff658,
target_udata=0xbffff5e8)
#4  0x8049f9c in __throw ()
#5  0x80495fd in func () at x.cc:9

I came across this problem while getting the new GCJ front end working
with Kaffe but though it easier to demonstrate the problem under C++.

Any help greatly appreciated.

Regards
Tim

--
  Tim Wilkinson                         Tel:     +1 510 704 1660
  Transvirtual Technologies, Inc.,      Fax:     +1 510 704 1893
  Berkeley, CA, USA.                    Email:   tim@transvirtual.com






More information about the Gcc-bugs mailing list