From: Brian Green <briangreenery@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Miscompilation: missing assignment in function that might throw
Date: Wed, 30 Aug 2023 10:38:42 -0700 [thread overview]
Message-ID: <CAHddVtZxToTdxddz2+-aOOe0B6qpDf6J0_uWEu7=Zj=1pZTPkw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
I was unable to create an account in the gcc bugzilla, so I am trying to
report this here.
The following code should always exit with "5". Starting in g++ 12.1, it
will exit with "5" at "-O0" and with random garbage at "-O1" or "-O2".
https://godbolt.org/z/T3qTnheYW
struct Int {
int value;
};
__attribute__((noipa)) Int always_throws() { throw 123; }
void foo(Int &x) {
try {
x = always_throws();
} catch (...) {
}
}
int main() {
Int x;
x.value = 5;
foo(x);
return x.value;
}
next reply other threads:[~2023-08-30 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 17:38 Brian Green [this message]
2023-08-30 19:23 ` Jonathan Wakely
2023-08-30 19:25 ` Jonathan Wakely
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='CAHddVtZxToTdxddz2+-aOOe0B6qpDf6J0_uWEu7=Zj=1pZTPkw@mail.gmail.com' \
--to=briangreenery@gmail.com \
--cc=gcc-help@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).