https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:5cb055e99d2026c734602ffdc28cb8b357a7b28e commit r13-8066-g5cb055e99d2026c734602ffdc28cb8b357a7b28e Author: Jonathan Wakely <jwak...@redhat.com> 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)