From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BB933858400; Sun, 23 Jan 2022 22:49:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BB933858400 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/104019] Testsuite 17_intro/headers/c++2020/stdc++_multiple_inclusion.cc failures Date: Sun, 23 Jan 2022 22:49:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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, 23 Jan 2022 22:49:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104019 --- Comment #6 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:2d8a9ad4a922e3248d0f6c60a6331be6f47dc435 commit r12-6826-g2d8a9ad4a922e3248d0f6c60a6331be6f47dc435 Author: Jonathan Wakely Date: Fri Jan 21 12:08:20 2022 +0000 libstdc++: Fix aliasing violation in std::shared_ptr [PR104019] The non-atomic store that sets both reference counts to zero uses a type-punned pointer, which has undefined behaviour. We could use memset to write 8 bytes, but we don't actually need it to be a single store anyway. No other thread can observe the values, that's why it's safe to use non-atomic stores in the first place. So we can just set each count to zero. With -fstore-merging (which is enabled by default at -O2) GCC produces the same code for this as for memset or the type punned store. Clang does that store merging even at -O1. libstdc++-v3/ChangeLog: PR libstdc++/104019 * include/bits/shared_ptr_base.h (_Sp_counted_base<>::_M_releas= e): Set members to zero without type punning.=