public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111245] New: miscompilation: missing assignment when exception thrown
@ 2023-08-30 20:19 briangreenery at gmail dot com
2023-08-30 20:26 ` [Bug ipa/111245] " briangreenery at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: briangreenery at gmail dot com @ 2023-08-30 20:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111245
Bug ID: 111245
Summary: miscompilation: missing assignment when exception
thrown
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: briangreenery at gmail dot com
Target Milestone: ---
gcc version 13.2.0 (Compiler-Explorer-Build-gcc--binutils-2.40)
Target: x86_64-linux-gnu
It looks like initialization is incorrectly skipped when:
* The initialization is overwritten by an unconditional assignment from a
function
* However, that function throws an exception which avoids the assignment
The following code should return 5, but it returns random garbage on -O1 or
-O2.
https://godbolt.org/z/T3qTnheYW
# 0 "/app/example.cpp"
# 1 "/app//"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "/app/example.cpp"
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] 5+ messages in thread
* [Bug ipa/111245] miscompilation: missing assignment when exception thrown
2023-08-30 20:19 [Bug c++/111245] New: miscompilation: missing assignment when exception thrown briangreenery at gmail dot com
@ 2023-08-30 20:26 ` briangreenery at gmail dot com
2023-08-30 21:42 ` [Bug ipa/111245] [12/13/14 Regression] " pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: briangreenery at gmail dot com @ 2023-08-30 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111245
--- Comment #1 from Brian Green <briangreenery at gmail dot com> ---
It seems working on gcc 11.4 or earlier, but broken since gcc 12.1 on all
versions I could test on godbolt.org.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown
2023-08-30 20:19 [Bug c++/111245] New: miscompilation: missing assignment when exception thrown briangreenery at gmail dot com
2023-08-30 20:26 ` [Bug ipa/111245] " briangreenery at gmail dot com
@ 2023-08-30 21:42 ` pinskia at gcc dot gnu.org
2023-08-30 22:26 ` jakub at gcc dot gnu.org
2023-08-31 10:48 ` [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown since r12-5244-g64f3e71c302b4a13e61656ee509e7050b9bce978 rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-30 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111245
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|miscompilation: missing |[12/13/14 Regression]
|assignment when exception |miscompilation: missing
|thrown |assignment when exception
| |thrown
Known to work| |11.4.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Target Milestone|--- |12.4
Last reconfirmed| |2023-08-30
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. I thought I saw another one almost the exact same but I can't find
it right now.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown
2023-08-30 20:19 [Bug c++/111245] New: miscompilation: missing assignment when exception thrown briangreenery at gmail dot com
2023-08-30 20:26 ` [Bug ipa/111245] " briangreenery at gmail dot com
2023-08-30 21:42 ` [Bug ipa/111245] [12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-08-30 22:26 ` jakub at gcc dot gnu.org
2023-08-31 10:48 ` [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown since r12-5244-g64f3e71c302b4a13e61656ee509e7050b9bce978 rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-08-30 22:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111245
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-5244-g64f3e71c302b4a13e61656ee509e7050b9bce978
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown since r12-5244-g64f3e71c302b4a13e61656ee509e7050b9bce978
2023-08-30 20:19 [Bug c++/111245] New: miscompilation: missing assignment when exception thrown briangreenery at gmail dot com
` (2 preceding siblings ...)
2023-08-30 22:26 ` jakub at gcc dot gnu.org
@ 2023-08-31 10:48 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-31 10:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111245
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Sounds like call LHS analysis mistake in modref.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-31 10:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 20:19 [Bug c++/111245] New: miscompilation: missing assignment when exception thrown briangreenery at gmail dot com
2023-08-30 20:26 ` [Bug ipa/111245] " briangreenery at gmail dot com
2023-08-30 21:42 ` [Bug ipa/111245] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-08-30 22:26 ` jakub at gcc dot gnu.org
2023-08-31 10:48 ` [Bug ipa/111245] [12/13/14 Regression] miscompilation: missing assignment when exception thrown since r12-5244-g64f3e71c302b4a13e61656ee509e7050b9bce978 rguenth at gcc dot gnu.org
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).