From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B18AF3858D20; Sun, 6 Feb 2022 10:26:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B18AF3858D20 From: "gcc at ebasoft dot com.pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104386] no_unique_address causes invalid member alignment of pod struct Date: Sun, 06 Feb 2022 10:26:26 +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: 11.2.1 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc at ebasoft dot com.pl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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, 06 Feb 2022 10:26:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104386 --- Comment #2 from Artur Ba=C4=87 --- I think it is connected with this case https://godbolt.org/z/cvfs1KqGW https://godbolt.org/z/vdzTzo7be //sizeof(foo) =3D=3D12 struct base { uint32_t x{}; std::byte v{}; base() noexcept =3D default; }; struct foo : public base { std::byte z; }; //sizeof(foo) =3D=3D 8 struct base { uint32_t x; std::byte v; base() noexcept : x{}, v{} {} }; struct foo : public base { std::byte z; }; and https://www.reddit.com/r/cpp/comments/slfugx/comment/hvs4n7j/?utm_source=3D= share&utm_medium=3Dweb2x&context=3D3 "Som1Lse =C2=B7 5 hr. ago Interestingly GCC disagrees with itself: -std=3Dc++17 it considers base to be a POD and doesn't reuse padding. -std=3Dc++20 it considers base to not be a POD and agrees with Clang, r= eusing the padding bytes."=