public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-106389-4-uaPGcvB88f@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106389-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106389

Marek Polacek <mpolacek at gcc dot gnu.org> 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 <mpolacek at gcc dot gnu.org> ---
[class.union] says that "At most one of the
non-static data members of an object of union type can be active at any time,
that is, the value of at most one of the non-static data members can be stored
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 sequence
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 <https://preshing.com/20150324/safe-bitfields-in-cpp/>.

  reply	other threads:[~2022-07-21 17:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 17:21 [Bug ipa/106389] New: " mpolacek at gcc dot gnu.org
2022-07-21 17:23 ` mpolacek at gcc dot gnu.org [this message]
2022-07-21 17:26 ` [Bug ipa/106389] [11/12/13 Regression] " mpolacek at gcc dot gnu.org
2022-07-22  7:09 ` [Bug c++/106389] " rguenth at gcc dot gnu.org
2022-07-22 12:53 ` mpolacek at gcc dot gnu.org
2022-07-24  9:05 ` hubicka at gcc dot gnu.org
2022-07-25  6:20 ` rguenth at gcc dot gnu.org
2023-05-29 10:07 ` [Bug c++/106389] [11/12/13/14 " jakub at gcc dot gnu.org
2023-07-08  1:45 ` pinskia at gcc dot gnu.org
2023-10-30 20:09 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106389-4-uaPGcvB88f@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).