From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6032E3858407; Tue, 14 Nov 2023 22:43:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6032E3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700001784; bh=uOpAoeVmjpSRWdCk5I8rmMUtZVKKQT3tOjnEpOfOMuk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ktfNn8gNLkD/42v4XdWeBZiB32illLiApnRNpcFl8teX/IelP9zX012OJwINPXNpz 6ytec/3D4nb+QRBbbZxBoJ73o+d6Vu/mse+Y3lUxXkU7OJUjuEabC3jQNzCqSIn86q ZcyKaVt8f9BpAzD7r1O/jOwXJtj9M3+/+FC2jjFQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/112491] std::deque::size xmethod output is wrong Date: Tue, 14 Nov 2023 22:43:04 +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: 13.2.1 X-Bugzilla-Keywords: 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: 11.5 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112491 --- Comment #4 from CVS Commits --- The releases/gcc-12 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:99f992a275c30bc8db2e6352e98ab81c89b5b7ed commit r12-9977-g99f992a275c30bc8db2e6352e98ab81c89b5b7ed Author: Jonathan Wakely Date: Tue Nov 14 15:08:13 2023 +0000 libstdc++: Fix std::deque::size() Xmethod [PR112491] The Xmethod for std::deque::size() assumed that the first element would be at the start of the first node. That's only true if elements are only added at the back. If an element is inserted at the front, or removed from the front (or anywhere before the middle) then the first node will not be completely populated, and the Xmethod will give the wrong result. libstdc++-v3/ChangeLog: PR libstdc++/112491 * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.size): Fix calculation to use _M_start._M_cur. * testsuite/libstdc++-xmethods/deque.cc: Check failing cases. (cherry picked from commit 4db820928065eccbeb725406450d826186582b9f)=