[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #12 from Jonathan Wakely  ---
(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.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #11 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:7cfe05d1ee351c2c01f75368a295afb3b712c056

commit r11-11100-g7cfe05d1ee351c2c01f75368a295afb3b712c056
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #10 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:d5200963cadc267e8fc72bcc9f62bd038d353d62

commit r12-9982-gd5200963cadc267e8fc72bcc9f62bd038d353d62
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #9 from CVS Commits  ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:5d6f62c9b2377b9b4c5b8c2eb1a6bcf00ba8ab2c

commit r13-8072-g5d6f62c9b2377b9b4c5b8c2eb1a6bcf00ba8ab2c
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:452476db0c705caeac8712d560fc16ced0ca5226

commit r14-5485-g452476db0c705caeac8712d560fc16ced0ca5226
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-15 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Status|RESOLVED|REOPENED

--- Comment #7 from Jonathan Wakely  ---
(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.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jonathan Wakely  ---
Fixed for 11.5, 12.4, 13.3 and 14.1.

Thanks for the report.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #5 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:57727d36e0a3d69dbd6b2221cde0624dbb9dfc95

commit r11-11098-g57727d36e0a3d69dbd6b2221cde0624dbb9dfc95
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #4 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:99f992a275c30bc8db2e6352e98ab81c89b5b7ed

commit r12-9977-g99f992a275c30bc8db2e6352e98ab81c89b5b7ed
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #3 from CVS Commits  ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:5cb055e99d2026c734602ffdc28cb8b357a7b28e

commit r13-8066-g5cb055e99d2026c734602ffdc28cb8b357a7b28e
Author: Jonathan Wakely 
Date:   Tue Nov 14 15:08:13 2023 +

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)

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- 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 +

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.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|--- |11.5

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

--- Comment #1 from Jonathan Wakely  ---
(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.

[Bug libstdc++/112491] std::deque::size xmethod output is wrong

2023-11-14 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112491

Jonathan Wakely  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