From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4A03C3858C56; Thu, 21 Jul 2022 17:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A03C3858C56 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/106389] [11/12/13 Regression] IPA modref breaks Safe Bitfields in C++ Date: Thu, 21 Jul 2022 17:23:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek 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: cc keywords priority target_milestone short_desc 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: Thu, 21 Jul 2022 17:23:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106389 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org Keywords| |wrong-code Priority|P3 |P2 Target Milestone|--- |11.4 Summary|IPA modref breaks Safe |[11/12/13 Regression] IPA |Bitfields in C++ |modref breaks Safe | |Bitfields in C++ --- Comment #1 from Marek Polacek --- [class.union] says that "At most one of the non-static data members of an object of union type can be active at any tim= e, that is, the value of at most one of the non-static data members can be sto= red in a union at any time.", however, it also has an exception: "One special guarantee is made in order to simplify the use of unions: If a standard-layout union contains several standard-layout structs that share a common initial sequence ([class.mem]), and if a non-static data member of an object of this standard-layout union type is active and is one of the standard-layout structs, it is permitted to inspect the common initial sequ= ence of any of the standard-layout struct members" so in this test, using the non-active union member doesn't trigger UB. More info at .=