From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AFD05385C421; Tue, 27 Jul 2021 12:03:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFD05385C421 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101641] New: Bogus redundant store removal Date: Tue, 27 Jul 2021 12:03:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.1.1 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone 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 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: Tue, 27 Jul 2021 12:03:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101641 Bug ID: 101641 Summary: Bogus redundant store removal Product: gcc Version: 11.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- union u { long x; long long y; }; __attribute__((noinline,noclone)) long test(long *px, long long *py, union u *pu) { *px =3D 0; *py =3D 1; long xy =3D pu->y; pu->x =3D xy; return *px; } int main () {=20=20=20=20 union u u; if (test (&u.x, &u.y, &u) !=3D 1) __builtin_abort (); return 0; } is miscompiled at -O2+ as FRE removes the seemingly redundant store to pu->x but that's needed to make the read via *px pick up the value stored via *py =3D 1 rather than (correctly) disambiguating against that and running into *px =3D 0.=