* Miscompilation: missing assignment in function that might throw
@ 2023-08-30 17:38 Brian Green
2023-08-30 19:23 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Brian Green @ 2023-08-30 17:38 UTC (permalink / raw)
To: gcc-help
[-- 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;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Miscompilation: missing assignment in function that might throw
2023-08-30 17:38 Miscompilation: missing assignment in function that might throw Brian Green
@ 2023-08-30 19:23 ` Jonathan Wakely
2023-08-30 19:25 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2023-08-30 19:23 UTC (permalink / raw)
To: Brian Green; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 787 bytes --]
On Wed, 30 Aug 2023, 18:39 Brian Green via Gcc-help, <gcc-help@gcc.gnu.org>
wrote:
> I was unable to create an account in the gcc bugzilla, so I am trying to
> report this here.
>
Please don't report bugs here. Did you send an email to get an account
created, as bugzilla says to do? Because I don't see any request from you.
> 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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Miscompilation: missing assignment in function that might throw
2023-08-30 19:23 ` Jonathan Wakely
@ 2023-08-30 19:25 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2023-08-30 19:25 UTC (permalink / raw)
To: Brian Green; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 989 bytes --]
On Wed, 30 Aug 2023, 20:23 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:
>
>
> On Wed, 30 Aug 2023, 18:39 Brian Green via Gcc-help, <gcc-help@gcc.gnu.org>
> wrote:
>
>> I was unable to create an account in the gcc bugzilla, so I am trying to
>> report this here.
>>
>
> Please don't report bugs here. Did you send an email to get an account
> created, as bugzilla says to do? Because I don't see any request from you.
>
Gah, it was in my spam folder, sorry. I'll get the account created now...
>
>
>> 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;
>> }
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-30 19:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 17:38 Miscompilation: missing assignment in function that might throw Brian Green
2023-08-30 19:23 ` Jonathan Wakely
2023-08-30 19:25 ` Jonathan Wakely
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).