* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
@ 2023-11-14 8:22 ` redi at gcc dot gnu.org
2023-11-14 14:56 ` redi at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Last reconfirmed| |2023-11-14
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
2023-11-14 8:22 ` [Bug libstdc++/112491] " redi at gcc dot gnu.org
@ 2023-11-14 14:56 ` redi at gcc dot gnu.org
2023-11-14 15:13 ` redi at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to ks1322 from comment #0)
> d.push_front(0);
The bug occurs when the first node of the deque is not filled from the first
element. That case was never tested.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
2023-11-14 8:22 ` [Bug libstdc++/112491] " redi at gcc dot gnu.org
2023-11-14 14:56 ` redi at gcc dot gnu.org
@ 2023-11-14 15:13 ` redi at gcc dot gnu.org
2023-11-14 15:58 ` cvs-commit at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 15:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (2 preceding siblings ...)
2023-11-14 15:13 ` redi at gcc dot gnu.org
@ 2023-11-14 15:58 ` cvs-commit at gcc dot gnu.org
2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:4db820928065eccbeb725406450d826186582b9f
commit r14-5450-g4db820928065eccbeb725406450d826186582b9f
Author: Jonathan Wakely <jwakely@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (3 preceding siblings ...)
2023-11-14 15:58 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 22:40 UTC (permalink / raw)
To: gcc-bugs
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
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:5cb055e99d2026c734602ffdc28cb8b357a7b28e
commit r13-8066-g5cb055e99d2026c734602ffdc28cb8b357a7b28e
Author: Jonathan Wakely <jwakely@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)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (4 preceding siblings ...)
2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
2023-11-14 23:11 ` cvs-commit at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 22:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:99f992a275c30bc8db2e6352e98ab81c89b5b7ed
commit r12-9977-g99f992a275c30bc8db2e6352e98ab81c89b5b7ed
Author: Jonathan Wakely <jwakely@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)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (5 preceding siblings ...)
2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 23:11 ` cvs-commit at gcc dot gnu.org
2023-11-14 23:12 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 23:11 UTC (permalink / raw)
To: gcc-bugs
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
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:57727d36e0a3d69dbd6b2221cde0624dbb9dfc95
commit r11-11098-g57727d36e0a3d69dbd6b2221cde0624dbb9dfc95
Author: Jonathan Wakely <jwakely@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)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (6 preceding siblings ...)
2023-11-14 23:11 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 23:12 ` redi at gcc dot gnu.org
2023-11-15 10:04 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 23:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 11.5, 12.4, 13.3 and 14.1.
Thanks for the report.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (7 preceding siblings ...)
2023-11-14 23:12 ` redi at gcc dot gnu.org
@ 2023-11-15 10:04 ` redi at gcc dot gnu.org
2023-11-15 11:28 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-15 10:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |---
Status|RESOLVED |REOPENED
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> The bug occurs when the first node of the deque is not filled from the first
> element. That case was never tested.
The deque::operator[] xmethod is wrong in the same scenarios.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (8 preceding siblings ...)
2023-11-15 10:04 ` redi at gcc dot gnu.org
@ 2023-11-15 11:28 ` cvs-commit at gcc dot gnu.org
2023-11-15 11:33 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 11:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:452476db0c705caeac8712d560fc16ced0ca5226
commit r14-5485-g452476db0c705caeac8712d560fc16ced0ca5226
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 14 15:08:13 2023 +0000
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]
The Xmethod for std::deque::operator[] has the same bug that I recently
fixed for the std::deque::size() Xmethod. The first node might have
unused capacity at the start, which needs to be accounted for when
indexing into the deque.
libstdc++-v3/ChangeLog:
PR libstdc++/112491
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
Correctly handle unused capacity at the start of the first node.
* testsuite/libstdc++-xmethods/deque.cc: Check index operator
when elements have been removed from the front.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (9 preceding siblings ...)
2023-11-15 11:28 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 11:33 ` cvs-commit at gcc dot gnu.org
2023-11-15 11:35 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:5d6f62c9b2377b9b4c5b8c2eb1a6bcf00ba8ab2c
commit r13-8072-g5d6f62c9b2377b9b4c5b8c2eb1a6bcf00ba8ab2c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 14 15:08:13 2023 +0000
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]
The Xmethod for std::deque::operator[] has the same bug that I recently
fixed for the std::deque::size() Xmethod. The first node might have
unused capacity at the start, which needs to be accounted for when
indexing into the deque.
libstdc++-v3/ChangeLog:
PR libstdc++/112491
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
Correctly handle unused capacity at the start of the first node.
* testsuite/libstdc++-xmethods/deque.cc: Check index operator
when elements have been removed from the front.
(cherry picked from commit 452476db0c705caeac8712d560fc16ced0ca5226)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (10 preceding siblings ...)
2023-11-15 11:33 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 11:35 ` cvs-commit at gcc dot gnu.org
2023-11-15 11:42 ` cvs-commit at gcc dot gnu.org
2023-11-15 11:44 ` redi at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 11:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:d5200963cadc267e8fc72bcc9f62bd038d353d62
commit r12-9982-gd5200963cadc267e8fc72bcc9f62bd038d353d62
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 14 15:08:13 2023 +0000
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]
The Xmethod for std::deque::operator[] has the same bug that I recently
fixed for the std::deque::size() Xmethod. The first node might have
unused capacity at the start, which needs to be accounted for when
indexing into the deque.
libstdc++-v3/ChangeLog:
PR libstdc++/112491
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
Correctly handle unused capacity at the start of the first node.
* testsuite/libstdc++-xmethods/deque.cc: Check index operator
when elements have been removed from the front.
(cherry picked from commit 452476db0c705caeac8712d560fc16ced0ca5226)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (11 preceding siblings ...)
2023-11-15 11:35 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 11:42 ` cvs-commit at gcc dot gnu.org
2023-11-15 11:44 ` redi at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 11:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:7cfe05d1ee351c2c01f75368a295afb3b712c056
commit r11-11100-g7cfe05d1ee351c2c01f75368a295afb3b712c056
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 14 15:08:13 2023 +0000
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]
The Xmethod for std::deque::operator[] has the same bug that I recently
fixed for the std::deque::size() Xmethod. The first node might have
unused capacity at the start, which needs to be accounted for when
indexing into the deque.
libstdc++-v3/ChangeLog:
PR libstdc++/112491
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
Correctly handle unused capacity at the start of the first node.
* testsuite/libstdc++-xmethods/deque.cc: Check index operator
when elements have been removed from the front.
(cherry picked from commit 452476db0c705caeac8712d560fc16ced0ca5226)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libstdc++/112491] std::deque<T,Allocator>::size xmethod output is wrong
2023-11-12 12:21 [Bug libstdc++/112491] New: std::deque<T,Allocator>::size xmethod output is wrong ks1322 at gmail dot com
` (12 preceding siblings ...)
2023-11-15 11:42 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 11:44 ` redi at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-15 11:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|REOPENED |RESOLVED
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> The deque::operator[] xmethod is wrong in the same scenarios.
And that should be fixed now as well.
^ permalink raw reply [flat|nested] 15+ messages in thread