This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [x86 PATCH] Mark builtin intrinsics as "nothrow"


Steven Bosscher <stevenb.gcc@gmail.com> writes:

> On Saturday 10 February 2007 04:14, Roger Sayle wrote:
> > The following simple patch tweaks i386.c's builtin_def function to
> > annotate the back-end intrinsics as "nothrow", by setting the TREE_NOTHROW
> > bit of their "decl".  This allows for simplification of the CFG at the
> > tree-level for C++ codes, such as in the example below:
> 
> Is this really safe if the builtin may trap (e.g. builtins for division
> vs. division by zero)?

AFAIK OS signals cannot be safely caught by C++ exception handlers.

If they could then basically everything can cause them (e.g. any
memory reference) and not much optimization on exception handlers
would be possible because their flow graph would contain
far too many edges.

That's even true with asynchronous unwind tables (which are only
for generating backtraces, not unwinding) 

There seem to be a few broken programs that throw from signal
handlers, but that can cause libgcc crashes by itself.

-andi


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