From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2A85C3856265; Wed, 15 Jun 2022 08:14:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A85C3856265 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103501] associative containers left invalid after allocator-extended move construction Date: Wed, 15 Jun 2022 08:14:40 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Wed, 15 Jun 2022 08:14:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103501 --- Comment #5 from CVS Commits --- The releases/gcc-10 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:d4fdb293004f2e104edf823d4820d4ee73aa2660 commit r10-10837-gd4fdb293004f2e104edf823d4820d4ee73aa2660 Author: Jonathan Wakely Date: Tue Nov 30 23:32:50 2021 +0000 libstdc++: Clear RB tree after moving elements [PR103501] If the allocator-extended move constructor move-constructs each element into the new container, the contents of the old container are left in moved-from states. We cannot know if those states preserve the container's ordering and uniqueness guarantees, so just erase all moved-from elements. libstdc++-v3/ChangeLog: PR libstdc++/103501 * include/bits/stl_tree.h (_Rb_tree(_Rb_tree&&, false_type)): Clear container if elements have been moved-from. * testsuite/23_containers/multiset/allocator/103501.cc: New tes= t. * testsuite/23_containers/set/allocator/103501.cc: New test. (cherry picked from commit 056551414a328b427c4bf4955b9a3832f344685c)=