asynchronous-exceptions handling

Loren James Rittle rittle@latour.rsch.comm.mot.com
Mon Jun 12 12:19:00 GMT 2000


> // The -fasynchronous-exceptions flags is not working !
> // here is a sample of an exception thrown from a signal
> // handler. This exception terminates the program although
> // it is a wrapped with "catch" statement.
> // Note: this bug doesn't occur on gcc-2.7.x!!!
> // compile with g++ -v -g  -fasynchronous-exceptions a.cc
> // on sun ultra1 running solaris 5.7

[Please note that you failed to tell us exactly which version of gcc
 you are now using.  That information is usually very helpful in a bug
 report; especially if you want someone outside your own company to
 take time to look at it. ;-]

There is no current documentation on this feature, but I think it is
true that -fasynchronous-exceptions only works on hosts that (a) use
setjump/longjump-based exceptions (you can enable them on a host using
the new style but you need to recompile all gcc support libraries) and
(b) allow a longjump out of an exception handler.  Needless to say,
this is not widely portable even across platforms that use gcc.

I suspect that gcc 2.7.x on Solaris uses setjump/longjump-based
exceptions but that more recent versions of gcc use the new form of
exception handling that is available for use with the ELF file format.

The simple example you posted works for me on i686-unknown-freebsd3.4
and sparc-sun-solaris2.6 under gcc 2.95.X with the following command
line options:

-fasynchronous-exceptions -fsjlj-exceptions

Without the -fsjlj-exceptions option, it fails on both platforms.

Note that had this example thrown an exception from the standard
library code, I would have to recompile the entire library with the
-fsjlj-exceptions option or else it would mysteriously fail as well.

Regards,
Loren


More information about the Gcc-bugs mailing list