]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa: Fix throw in multi-versioned functions [PR106627]
authorSimon Rainer <gcc.gnu@vvalter.com>
Wed, 31 Aug 2022 21:00:08 +0000 (23:00 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 2 Sep 2022 06:06:14 +0000 (08:06 +0200)
commit0b0a3cdbff64d97e7de3e0e2c26e965708064193
treed285ecf1c0f7d1242fa58571fa94f0cc03796d7d
parentbb0a1556df79d02cf570f5eb17a1b02a509f0be4
ipa: Fix throw in multi-versioned functions [PR106627]

Any multi-versioned function was implicitly declared as noexcept, which
leads to an abort if an exception is thrown inside the function.
The reason for this is that the function declaration is replaced by a
newly created dispatcher declaration, which has TREE_NOTHROW always set
to 1. Instead we need to set TREE_NOTHROW to the value of the original
declaration.

PR ipa/106627

gcc/ChangeLog:

* config/i386/i386-features.cc (ix86_get_function_versions_dispatcher):
Set TREE_NOTHROW correctly for dispatcher declaration.
* config/rs6000/rs6000.cc (rs6000_get_function_versions_dispatcher):
Likewise.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr106627.C: New test.
gcc/config/i386/i386-features.cc
gcc/config/rs6000/rs6000.cc
gcc/testsuite/g++.target/i386/pr106627.C [new file with mode: 0644]