This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Throwing from a signal handler
Florian Weimer wrote:
> * Andrew Haley:
>
>> Florian Weimer wrote:
>>> Under what circumstances is it possible to throw a C++ exception from
>>> a signal handler? (I'm most interested in GNU/Linux with libc 2.7 and
>>> later.)
>> It depends on the architecture, but we have support on x86 and a bunch
>> of others. Compile with -fnon-call-exceptions.
>
> How does this affect code generation?
It doesn't affect the code very much, but it does generate a good deal
more unwinder data. It affects instruction combination: obviously, if
an instruction may trap, then you can't combine it with its successor.
It also affects anything that involves memory accesses: if writes may
trap, you can't reorder them.
grep for flag_non_call_exceptions in the source and you'll see the
differences.
Andrew.