public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114585] New: Incorrect boolean value with O2/O3 optimisation
@ 2024-04-04 13:58 fried.ink at pm dot me
2024-04-04 14:07 ` [Bug c++/114585] " schwab@linux-m68k.org
2024-04-04 14:22 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: fried.ink at pm dot me @ 2024-04-04 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114585
Bug ID: 114585
Summary: Incorrect boolean value with O2/O3 optimisation
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fried.ink at pm dot me
Target Milestone: ---
Created attachment 57875
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57875&action=edit
Example code demonstrating the issue
Example code attached which demonstrates that the result of some C++ boolean
logic is incorrect when compiled with -O2 or -O3 optimisation levels.
The example has identical logic in main and the function add, but in the
function add, values for overflow_pos and overflow evaluate incorrectly.
Testing with godblot, https://godbolt.org/z/9aneq77Ed, this behaviour is
observed with g++ versions 12.1 through 13.2.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/114585] Incorrect boolean value with O2/O3 optimisation
2024-04-04 13:58 [Bug c++/114585] New: Incorrect boolean value with O2/O3 optimisation fried.ink at pm dot me
@ 2024-04-04 14:07 ` schwab@linux-m68k.org
2024-04-04 14:22 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2024-04-04 14:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114585
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Signed integer overflow is undefined.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/114585] Incorrect boolean value with O2/O3 optimisation
2024-04-04 13:58 [Bug c++/114585] New: Incorrect boolean value with O2/O3 optimisation fried.ink at pm dot me
2024-04-04 14:07 ` [Bug c++/114585] " schwab@linux-m68k.org
@ 2024-04-04 14:22 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2024-04-04 14:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114585
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The bug reporting guidelines you were asked to read say to try
-fsanitize=undefined and if you'd done that you'd have seen errors:
https://godbolt.org/z/bscj8q9rr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-04 14:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 13:58 [Bug c++/114585] New: Incorrect boolean value with O2/O3 optimisation fried.ink at pm dot me
2024-04-04 14:07 ` [Bug c++/114585] " schwab@linux-m68k.org
2024-04-04 14:22 ` redi 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).