From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DB43E3858C20; Mon, 25 Jul 2022 06:20:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB43E3858C20 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106389] [11/12/13 Regression] IPA modref breaks Safe Bitfields in C++ Date: Mon, 25 Jul 2022 06:20:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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: Mon, 25 Jul 2022 06:20:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106389 --- Comment #6 from Richard Biener --- (In reply to Marek Polacek from comment #4) > (In reply to Richard Biener from comment #3) > > For the rule to take effect the frontend needs to mark each access that > > falls under the rule as to have alias-set zero. >=20 > Something like: make c_common_get_alias_set return -1 for those > COMPONENT_REFs in a standard-layout union that share a common initial > sequence, and are standard-layout structs? return 0, not -1 for them. But note to be reliable you'd have to do this for the actual aggregate type, not just COMPONENT_REFs since we have to be able to re-query TBAA from the types (and COMPONENT_REFs might get lost). See also the response from Honza. union U { struct A { int i; } a; struct B { int i; int f; } b; } u; is 'u.a' accessing the common initial sequence of A and B btw.?=