From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 87904385840E; Fri, 10 May 2024 01:31:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87904385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715304711; bh=/A7GUp2IG+JKFURW4UyFLUlb1VaQNaS7G7uXwMJYW7Y=; h=From:To:Subject:Date:From; b=hA9gE0LgzmIQ40YipM7+13ghsu8c2bzvBdPR36Y4B8Jj4i8I8l0NSbpukoERPz5LH 9hDUdBw4tIXgWjHGExWu1teLBtI9CG/77yyTGu1PiRWOBNCkQKYQJySA5oh2xZOv5o PknmVcXubnWNAhhjtX/HMGSJMkW+Q/Eux6Q02O6g= From: "djnz00 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/115019] New: wraparound bug with with -O3 and int128 Date: Fri, 10 May 2024 01:31:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: djnz00 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115019 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=3D58157&action=3Dedit reduced testcase wraparound and condition testing of 128bit values performs incorrectly under -O3: __int128_t i =3D ((__uint128_t)1)<<127; do { puts(itoa128(buf, i)); /* do something with i */ i +=3D ((__uint128_t)1)<<125; } while (i); in other code, this loop runs interminably under -O3, but completes as expe= cted without optimization; in this reduced testcase sample, it only executes one repeat of the loop (clang does it correctly); either way, there is a diverg= ence of behavior with/without -O3=