http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53805
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-29
14:34:08 UTC ---
(In reply to comment #4)
> On Fri, 29 Jun 2012, rguenth at gcc dot gnu.org wrote:
>
> > We do not try to preserve traps instead we only try to not produce new ones.
>
> That's a bug. -ftrapping-math should do both (as regards the set of
> exceptions raised between function calls or asms that might test them, not
> necessarily preserving the exact positive number of times an exception is
> raised). If that's thought to be a performance issue maybe it should be
> split into separate options for the two cases.
We happily remove dead trapping statements:
void foo(double x, int y)
{
1 / x;
1 / y;
}
Eric recently (for the sake of Java) added fdelete-dead-exceptions (in Ada,
with -fnon-call-exceptions, you are allowed to remove the above statements).
We similarly happily remove dead indirect loads (that might trap).
I think it is preferable that we do all this, we can't always reasonably
prove that a path in the CFG is never reached.