From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15AB93858D28; Fri, 22 Mar 2024 14:18:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15AB93858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711117104; bh=pwcHRjfqpqJiZr/2aesNkt9T9ZXvW5hAwBNMdQ2lGS0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YE2OdCZRpPOjjDE6dwylPDNzWhjLKtwemguSP8pNjYSZJd0pUDebO2QERMb1tFwIP cuUV27PJz6zstt7VU9f2lqSUNEPBhlnc+NrlaK0itTQjFwt+XdARFDSedJLOOmMBmw z37TYvvTZ12h7G1Iz9A5ux5OZm6+q9z0wEUlTvHE= 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 14:18:23 +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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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 #6 from Jakub Jelinek --- Though, guess it would help if evrp avoided undesirable propagation here: It is changing: : # DEBUG BEGIN_STMT _8 =3D .ADD_OVERFLOW (d_7(D), 0); _1 =3D IMAGPART_EXPR <_8>; _2 =3D (_Bool) _1; # DEBUG o =3D> (int) _2 # DEBUG BEGIN_STMT a.0_3 =3D a; _4 =3D (_BitInt(2000)) a.0_3; c.1_5 =3D c; m_11 =3D _4 * c.1_5; # DEBUG m =3D> m_11 # DEBUG BEGIN_STMT u_12 =3D (unsigned int) m_11; # DEBUG u =3D> u_12 # DEBUG BEGIN_STMT - o.2_6 =3D (unsigned int) _2; + o.2_6 =3D (unsigned int) _1; _13 =3D o.2_6 + u_12; return _13; } which is surely possible because IMAGPART_EXPR of .{ADD,SUB,MUL}_OVERFLOW h= as [0, 1] range, but for such large/huge _BitInt IMAGPART_EXPR it extends the lifetim= e of an expensive large variable rather than just being a boolean.=