From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AA23F3858403; Fri, 22 Mar 2024 11:50:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA23F3858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711108256; bh=lWiJ1QSS7a9Q3jCQwV4shFbCO8yMHvXtmed+TZzqJrQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fbCyEptY81ClkcQOBq1U1Lycl2HUlHEeunFVD8tA1ID2rQcliEKiv6AdjPTxwHohL wgxCtCIcXCnIJYWGH6uVQU+8kKcIPpI9ULItk4+YuB75zY9Le8zSgeEWbPtPXTxCMX hpL7dxz4nJV6y5LoHeQELH8X6lXmfitBUhgBUT9w= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114425] wrong code with _BitInt() __builtin_add_overflow_p() and __builtin_mul_overflow_p() at -O2 Date: Fri, 22 Mar 2024 11:50:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: Message-ID: In-Reply-To: References: 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=3D114425 --- Comment #2 from Jakub Jelinek --- Strangely it is dependent on the printf loop, without that it works fine. Slightly adjusted testcase: #if __BITINT_MAXWIDTH__ >=3D 2000 _BitInt(8) a; _BitInt(300) b; _BitInt(2000) c; unsigned foo (_BitInt(2000) d) { int o =3D __builtin_add_overflow_p (d, 0, b); _BitInt(2000) m =3D c * a; unsigned u =3D m; return u + o; } __attribute__((noipa)) void bar (int x) { (void) x; } #endif int main () { #if __BITINT_MAXWIDTH__ >=3D 2000 unsigned x =3D foo (0xfa7ac16f2613255eeb217e871c1f02221e26ce11f82d6a33206ec0ad5d4414722019933c= 0e2wb); for (unsigned i =3D 0; i < sizeof (x); i++) bar (((volatile unsigned char *) &x)[i]); if (x !=3D 1) __builtin_abort (); #endif }=