From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D402D3857B80; Sun, 24 Jul 2022 09:05:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D402D3857B80 From: "hubicka 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: Sun, 24 Jul 2022 09:05:46 +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: hubicka 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: Sun, 24 Jul 2022 09:05:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106389 --- Comment #5 from Jan Hubicka --- I agree with Richi that this is not modref bug. It merely exposes the fact = that we intentionally ignore this rule. For single compilation unit this rule is already problematic since one can = not determine alias sets incrementally. If struct A and struct B share same ini= tial segment one needs to delay any TBAA decisions about them until the end of translation unit when one knows if union of A and B exists and then one nee= ds to pesimize the optimization. However standard does not seem to require union to be in the given translat= ion unit (think of comdat inlines where aliasing of A/B happens in one translat= ion unit and function is called from other). Moreover with LTO we do not stream types not needed for a given partition of program and the union may thus be lost on the way. So I do not see how to implement this correctly short of 1) giving up on base alias set disambiguations 2) delaying all alias set constructions after finalizing all user defined types, look for all possible initial segments and hack alias oracle to know about this. Even this is hard since we currently do disambiguations based = on pairs base_set, ref_set without knowing the offset of ref_set inside base_s= et so given two pairs base_set1, ref_set1 base_set2, ref_set2 we would not be able to disambiguate accesses with same ref sets that occurs after the common initial part of the type. So indeed I would prefer this to stay undefined and require may_alias attri= bute in the user code...=