From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9F1063858D1E; Fri, 30 Sep 2022 21:34:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F1063858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664573655; bh=AUDs+jBLXizM7k+5P/4DPzAKHupCBdR+l2t10Aq9JhI=; h=From:To:Subject:Date:From; b=IwhFLFmcKp2J8CM/7hVrXPJJTB9S/PTDvc1dmnxLYlz9aq3jb5y5jGaAJZAY8KR3w 70x/p2y4KNK5WXBUq+FWWyabs83444moN43gjZZ4oEmlY6Pf05araeN5VSweVMWDNe VdNDqsgkeCq6X2AIS+/bw6UvO58QSpaxRi83gyvk= From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107107] New: Wrong codegen from TBAA when stores to distinct same-mode types are collapsed? Date: Fri, 30 Sep 2022 21:34:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx 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=3D107107 Bug ID: 107107 Summary: Wrong codegen from TBAA when stores to distinct same-mode types are collapsed? Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bugdal at aerifal dot cx Target Milestone: --- Created attachment 53646 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53646&action=3Dedit original test case by supercat The attached test case is from user supercat on Stack Overflow (original source: https://stackoverflow.com/questions/42178179/will-casting-around-sockaddr-s= torage-and-sockaddr-in-break-strict-aliasing/42178347?noredirect=3D1#commen= t130509588_42178347, https://godbolt.org/z/83v4ssrn4) and demonstrates wrong TBAA apparently assuming an object of type long long was not modified after the code path modifying it was collapsed with a different code path performing the modification via an lvalue of type long. On 64-bit targets, the test program outputs 1/2 with optimization levels th= at enable -fstrict-aliasing. The expected output is 2/2. Using -fno-strict-aliasing fixes it. I have not checked this myself, but according to others who have looked at = the test case, the regression came between GCC 4.7 and 4.8.=