https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115019
Bug ID: 115019 Summary: wraparound bug with with -O3 and int128 Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: djnz00 at gmail dot com Target Milestone: --- Created attachment 58157 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58157&action=edit reduced testcase wraparound and condition testing of 128bit values performs incorrectly under -O3: __int128_t i = ((__uint128_t)1)<<127; do { puts(itoa128(buf, i)); /* do something with i */ i += ((__uint128_t)1)<<125; } while (i); in other code, this loop runs interminably under -O3, but completes as expected without optimization; in this reduced testcase sample, it only executes one repeat of the loop (clang does it correctly); either way, there is a divergence of behavior with/without -O3