https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:57727d36e0a3d69dbd6b2221cde0624dbb9dfc95 commit r11-11098-g57727d36e0a3d69dbd6b2221cde0624dbb9dfc95 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)