[Bug c++/106627] Exception from multiversion function cannot be caught

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 15 15:04:39 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-08-15
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, not a regression.

Using a wrapper function does not fully work either, you need to mark the
function as noipa (I suspect the new function for f is being marked as nonthrow
for some reason):
__attribute__((target("default")))
void f() {
    throw 1;
}

__attribute__((target("sse4.2")))
void f() {
    throw 2;
}
[[gnu::noipa]]
void f1()
{
    f();
}

int main()
{
    try {
        f1();
    }
    catch(... )
    {
        return 0;
    }
    return 1;
}


More information about the Gcc-bugs mailing list