[Bug ipa/106627] Exception from multiversion function cannot be caught
gcc.gnu at vvalter dot com
gcc-bugzilla@gcc.gnu.org
Sun Aug 28 19:52:13 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106627
--- Comment #2 from Simon Rainer <gcc.gnu at vvalter dot com> ---
Created attachment 53518
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53518&action=edit
Proposed patch: Set TREE_NOTHROW correctly
I think I identified the issue and found a fix.
ix86_get_function_versions_dispatcher creates a new dispatch declaration that
has always TREE_NOTHROW set to 1, because it is created by build_fn_decl.
It seems like the original function declaration has TREE_NOTHROW set correctly,
so it's enough to set TREE_NOTHROW on the newly created dispatch declaration to
this value.
With the attached patch, I was able to catch exceptions from multiversioned
functions as expected. I also checked manually that if none of the function
versions raise an exception, TREE_NOTHROW is correctly set to 1.
The same code is used for RS/6000 and I'm pretty confident that the same patch
works there, but I'm unable to test this.
More information about the Gcc-bugs
mailing list