public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/115019] New: wraparound bug with with -O3 and int128
@ 2024-05-10  1:31 djnz00 at gmail dot com
  2024-05-10  1:37 ` [Bug c/115019] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: djnz00 at gmail dot com @ 2024-05-10  1:31 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-10  1:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10  1:31 [Bug c/115019] New: wraparound bug with with -O3 and int128 djnz00 at gmail dot com
2024-05-10  1:37 ` [Bug c/115019] " pinskia at gcc dot gnu.org
2024-05-10  1:50 ` pinskia at gcc dot gnu.org
2024-05-10  1:54 ` pinskia 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).