From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 396933858C20; Tue, 14 Nov 2023 15:58:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 396933858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699977511; bh=iBNfAtNTtQQsSR1wl1K0cnour4krpzAw8VVX94lccww=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AewtR753x8pLekwx/GIUqn5ZXGzTkmojb+JrWuW1FUP1IUMvZ1hZ+fXHaIOW/G5fB 5mlQEPhcG7DRV662ygzHqsewzQXcLJ8TgtcbM3AXKE18IZtrxMYtqxDKVgGdbSEPZW 4ayNTFSAtrYaFWC9h5a/iL7ELtpqfTT3lJ9Tuvqs= 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 15:58:30 +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 #2 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:4db820928065eccbeb725406450d826186582b9f commit r14-5450-g4db820928065eccbeb725406450d826186582b9f 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.=