This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR middle-end/53590
> +@item -fdelete-dead-exceptions
> +@opindex fdelete-dead-exceptions
> +Assume that statements that may raise exceptions but don't otherwise
> contribute +to the execution of the program can be optimized away.
> +
> This flag is set by the frontends according to their language
> specification. Passes that cause dead exceptions to be removed are enabled
> independently at different optimization levels.
>
> and be done with that.
OK, will make the change.
> Btw, what is "doesn't otherwise contribute to the execution"?
> That is, is the Ada equivalent of
>
> try { a / maybe_zero; } catch (...) { printf ("maybe_zero was zero!"); }
>
> dead code?
Essentially, yes. There is a special permission to optimize it away if the
result of the division isn't used.
> Btw, I suppose you need to arrange to properly transfer the flag for LTO
> in some way (well, or conservatively not remove dead exceptions at
> link-time).
I can add a flag in 'struct function' next to can_throw_non_call_exceptions.
--
Eric Botcazou