public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "coillol at yandex dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109039] New: Miscompilation with no_unique_address and bitfields Date: Mon, 06 Mar 2023 10:46:30 +0000 [thread overview] Message-ID: <bug-109039-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109039 Bug ID: 109039 Summary: Miscompilation with no_unique_address and bitfields Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: coillol at yandex dot ru Target Milestone: --- g++ miscompiles the following code starting from version 12.1 (-std=c++20, any optimization mode). ``` #include <cassert> struct X { short x0 : 7; short x1 : 8; X() { init(); assert(get() == 3); } void init() { x0 = 1; x1 = 2; } int get() { return x0 + x1; } }; struct S { [[no_unique_address]] X x; char c = 0; }; int main() { S s; assert(s.x.get() == 3); return 0; } ``` Program hits assertion in main when executed. Links to godbolt: https://godbolt.org/z/xG186673P (12.1), https://godbolt.org/z/MaP56rfhe (trunk).
next reply other threads:[~2023-03-06 10:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-06 10:46 coillol at yandex dot ru [this message] 2023-03-06 14:44 ` [Bug c++/109039] [12/13 Regression] " ppalka at gcc dot gnu.org 2023-03-06 14:59 ` jakub at gcc dot gnu.org 2023-03-09 14:56 ` jakub at gcc dot gnu.org 2023-03-09 16:57 ` jakub at gcc dot gnu.org 2023-03-09 17:12 ` jakub at gcc dot gnu.org 2023-03-10 19:37 ` cvs-commit at gcc dot gnu.org 2023-03-10 19:45 ` [Bug c++/109039] [12 " jakub at gcc dot gnu.org 2023-03-19 5:30 ` cvs-commit at gcc dot gnu.org 2023-03-20 10:29 ` jakub 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-109039-4@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: linkBe 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).