https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Bug ID: 112491 Summary: std::deque<T,Allocator>::size xmethod output is wrong Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ks1322 at gmail dot com Target Milestone: --- For this code: ``` #include <deque> int main() { std::deque<int> d; d.push_front(0); return 0; } ``` deque size xmethod produces wrong result ``` $ gdb -batch -ex "b 8" -ex r -ex "p d.size()" a.out Breakpoint 1 at 0x4011f5: file /tmp/t.cpp, line 8. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, main () at /tmp/t.cpp:8 8 return 0; $1 = 128 ``` Expected result is 1 while actual result is 128. As a workaround xmethods can be disabled with `disable xmethod` ``` $ gdb -batch -ex "b 8" -ex r -ex "disable xmethod" -ex "p d.size()" a.out Breakpoint 1 at 0x4011f5: file /tmp/t.cpp, line 8. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, main () at /tmp/t.cpp:8 8 return 0; $1 = 1 ```