From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A70313858415; Wed, 6 Oct 2021 10:13:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A70313858415 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102627] wrong code with "-O1" Date: Wed, 06 Oct 2021 10:13:24 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2021 10:13:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102627 --- Comment #1 from Richard Biener --- Even with plain -O1 I see the wrong 0 result, -O0 and -O2 are fine. Testca= se that aborts: int a, f, l, m, q, c, d, g; long b, e; struct g { signed h; signed i; unsigned j; unsigned k; }; unsigned n; char o; int *p =3D &m; long r(int s) { return s && b ?: b; } long __attribute__((noipa)) v() { l =3D 0 || r(n & o); return q; } void w(int, unsigned, struct g x) { c ?: a; for (; d < 2; d++) *p =3D x.k; } struct g __attribute__((noipa)) y() { struct g h =3D {3, 908, 1, 20}; for (; g; g++) ; return h; } int main() { long t; struct g u =3D y(); t =3D e << f; w(0, t, u); v(0, 4, 4, 4); if (m !=3D 20) __builtin_abort (); return 0; }=