From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B007B3858C20; Sat, 1 Oct 2022 20:00:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B007B3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664654439; bh=LqJEr470C3+IM0ceG+bjpbMqJoKlhxkxcGSbS1I46Qs=; h=From:To:Subject:Date:From; b=XZOfprBO+bvIZuHzR7Q944aqp9y1V1xaBwQ7N9ui59XWTB643v0WpNioN9Qo1GUDv 1xOfqvwykjJ4MaxvBKMj1r34tj51uRrlGaX6J2VytqBV7J2pqn1dVfKMlc0qZZLeE+ VENzWxkMjFNlBeIBq1pVxLTiSKDzrUBeAKTmqnjE= From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107115] New: Wrong codegen from TBAA under stores that change effective type? Date: Sat, 01 Oct 2022 20:00:39 +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=3D107115 Bug ID: 107115 Summary: Wrong codegen from TBAA under stores that change effective type? 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 53648 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53648&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= t130510083_42178347, https://godbolt.org/z/jfv1Ge6v4) and demonstrates what appears to be wrong = TBAA optimization on an object with allocated storage whose effective type chang= es under stores. It was first presented as another example of this kind of pro= blem alongside the example that became https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107107, but it seems likely = that the root cause is distinct. Reportedly clang/LLVM also transforms this example wrong. On 64-bit targets, the test program outputs 2/1 with optimization levels th= at enable -fstrict-aliasing. The expected output is 2/2. Using -fno-strict-aliasing fixes it.=