public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gcc.gnu at vvalter dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/106627] Exception from multiversion function cannot be caught
Date: Sun, 28 Aug 2022 19:52:13 +0000	[thread overview]
Message-ID: <bug-106627-4-2Wk8Xhnazq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106627-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2022-08-28 19:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 13:14 [Bug c++/106627] New: " gcc.gnu at vvalter dot com
2022-08-15 15:04 ` [Bug c++/106627] " pinskia at gcc dot gnu.org
2022-08-28 19:52 ` gcc.gnu at vvalter dot com [this message]
2022-08-31 13:37 ` [Bug ipa/106627] " marxin at gcc dot gnu.org
2022-09-02  6:06 ` cvs-commit at gcc dot gnu.org
2022-10-28 20:12 ` pinskia at gcc dot gnu.org
2023-10-29 15:49 ` pinskia at gcc dot gnu.org
2023-10-30  5:49 ` xry111 at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106627-4-2Wk8Xhnazq@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).