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.

Reply via email to