-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clangClang issues not falling into any other categoryClang issues not falling into any other categoryextension:gnumiscompilation
Description
| Bugzilla Link | 51021 |
| Version | trunk |
| OS | Linux |
| CC | @dwblaikie,@DougGregor,@efriedma-quic,@zygoloid |
Extended Description
The GCC developers have clarified that the function attributes const and pure do not imply that the functions do not throw. clang does assume that and as such miscompiles the following program:
__attribute__((const)) void f() {
throw 0;
}
int main() {
try {
f();
} catch(int i) {
return 0;
}
return 1;
}This program should return 0, not 1.
Godbolt link: https://godbolt.org/z/jj1PG7o78
(Please ignore the warning emitted by GCC, 'const' attribute on function returning 'void'; I have reported that as part of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101376.)
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clangClang issues not falling into any other categoryClang issues not falling into any other categoryextension:gnumiscompilation