[Bug middle-end/82504] Optimize away exception allocation and throws handled by catch(...){}

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 10 14:21:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82504

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The example isn't very interesting because it's not very realistic code. To be
useful we need this to happen after inlining:

void foo() {
    throw 1;
}

void bar()
    try {
        foo();
    } catch(...) {}
}

If we can elide the exception when foo() is inlined into bar() then I agree it
would be a valuable optimization.


More information about the Gcc-bugs mailing list