* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
@ 2015-07-02 19:40 ` daniel.kruegler at googlemail dot com
2015-07-02 20:47 ` redi at gcc dot gnu.org
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2015-07-02 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Your definition of operator!= for the allocator test_alloc violates the
allocator requirements, which impose that != behaves the same as the negation
of == (see Table 28 — Allocator requirements, [allocator.requirements]). This
violates causes undefined behaviour. Therefore it seems to me as if this is an
invalid bug report.
>From gcc-bugs-return-491304-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 02 20:02:23 2015
Return-Path: <gcc-bugs-return-491304-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23928 invoked by alias); 2 Jul 2015 20:02:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23905 invoked by uid 48); 2 Jul 2015 20:02:18 -0000
From: "gerhard.steinmetz.fortran@t-online.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66725] Issue with silent conversion int to char, ICE if int too large
Date: Thu, 02 Jul 2015 20:02:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.1.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: gerhard.steinmetz.fortran@t-online.de
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66725-4-2B0pF0hUtB@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66725-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66725-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg00194.txt.bz2
Content-length: 858
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf725
--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
A more extensive list of different cases :
close (1, status%7)
open (1, access%7)
open (1, action%7)
open (1, asynchronous%7)
open (1, blank%7)
open (1, delim%7)
open (1, decimal%7)
open (1, encoding%7)
open (1, form%7)
open (1, pad%7)
open (1, position%7)
open (1, round%7)
open (1, sign%7)
open (1, status%7)
read (1, asynchronous%7)
read (1, blank%7)
read (1, delim%7)
read (1, decimal%7)
read (1, pad%7)
read (1, round%7)
read (1, sign%7)
write (1, asynchronous%7)
write (1, blank%7)
write (1, delim%7)
write (1, decimal%7)
write (1, pad%7)
write (1, round%7)
write (1, sign%7)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
2015-07-02 19:40 ` [Bug libstdc++/66742] " daniel.kruegler at googlemail dot com
@ 2015-07-02 20:47 ` redi at gcc dot gnu.org
2015-07-03 8:14 ` mdiluzio at feralinteractive dot com
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-02 20:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Indeed. Splicing lists has a precondition that l1.get_allocator() ==
l2.get_allocator(), and so we check:
if (l1.get_allocator() != l2.get_allocator())
abort();
and obviously that fails for your invalid allocator type.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
2015-07-02 19:40 ` [Bug libstdc++/66742] " daniel.kruegler at googlemail dot com
2015-07-02 20:47 ` redi at gcc dot gnu.org
@ 2015-07-03 8:14 ` mdiluzio at feralinteractive dot com
2015-07-03 8:20 ` mdiluzio at feralinteractive dot com
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mdiluzio at feralinteractive dot com @ 2015-07-03 8:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
--- Comment #3 from Marc Di Luzio <mdiluzio at feralinteractive dot com> ---
Created attachment 35901
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35901&action=edit
main.ii
Updating with a valid ==/!= operator pair and state handling, apologies for the
original bad test case.
gcc output is the same verbatim as above.
However, sort still aborts with any allocator that provides ==/!= operators
based on internal state that is non-default.
sort contains a default constructed list __carry, which will have a different
allocator instance to the parent list if an allocator was passed in on
construction -
list.tcc:402
list __carry;
__carry is then spliced with the parent list -
list.tcc:409
__carry.splice(__carry.begin(), *this, begin());
A check then occurs if the two allocators are equal -
stl_list.h:1374
if (this != &__x)
_M_check_equal_allocators(__x);
allocator.h:188
static bool
_S_do_it(const _Alloc& __one, const _Alloc& __two)
{ return __one != __two; }
This final check will fail if the != operator for the allocator is dependent on
internal state comparison, which has differs from the default.
This appears to be incorrect, unless I'm misunderstanding the purpose of the
==/!= operators for allocators?
If this is still considered an issue, I would suggest that __carry be copy
constructed.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (2 preceding siblings ...)
2015-07-03 8:14 ` mdiluzio at feralinteractive dot com
@ 2015-07-03 8:20 ` mdiluzio at feralinteractive dot com
2015-07-03 10:20 ` redi at gcc dot gnu.org
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mdiluzio at feralinteractive dot com @ 2015-07-03 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Marc Di Luzio <mdiluzio at feralinteractive dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #4 from Marc Di Luzio <mdiluzio at feralinteractive dot com> ---
I've verified with 5.1 as well now, and the abort still occurs
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (3 preceding siblings ...)
2015-07-03 8:20 ` mdiluzio at feralinteractive dot com
@ 2015-07-03 10:20 ` redi at gcc dot gnu.org
2015-07-03 10:29 ` redi at gcc dot gnu.org
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-03 10:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-07-03
Ever confirmed|0 |1
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Marc Di Luzio from comment #3)
> If this is still considered an issue, I would suggest that __carry be copy
> constructed.
No, it needs to be constructed empty, but with the same allocator:
list __carry(get_allocator());
Unfortunately so does every element of the array __tmp:
list __tmp[64] = { get_allocator(), get_allocator(), get_allocator(),...
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (4 preceding siblings ...)
2015-07-03 10:20 ` redi at gcc dot gnu.org
@ 2015-07-03 10:29 ` redi at gcc dot gnu.org
2021-04-10 0:53 ` [Bug libstdc++/66742] abort on sorting list with custom allocator " ahuszagh at gmail dot com
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-03 10:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So we need something ugly like this:
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -398,6 +398,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
}
+#define _GLIBCXX_REPEAT_8(_X) _X, _X, _X, _X, _X, _X, _X, _X
+
template<typename _Tp, typename _Alloc>
void
list<_Tp, _Alloc>::
@@ -407,8 +409,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
&& this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
{
- list __carry;
- list __tmp[64];
+ list __carry(get_allocator());
+ list __tmp[64] = {
+ _GLIBCXX_REPEAT_8(_GLIBCXX_REPEAT_8(list(get_allocator())))
+ };
list * __fill = &__tmp[0];
list * __counter;
@@ -484,8 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
&& this->_M_impl._M_node._M_next->_M_next !=
&this->_M_impl._M_node)
{
- list __carry;
- list __tmp[64];
+ list __carry(get_allocator());
+ list __tmp[64] = {
+ _GLIBCXX_REPEAT_8(_GLIBCXX_REPEAT_8(list(get_allocator())))
+ };
list * __fill = &__tmp[0];
list * __counter;
@@ -511,6 +517,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
swap(*(__fill - 1));
}
}
+#undef _GLIBCXX_REPEAT_8
_GLIBCXX_END_NAMESPACE_CONTAINER
} // namespace std
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (5 preceding siblings ...)
2015-07-03 10:29 ` redi at gcc dot gnu.org
@ 2021-04-10 0:53 ` ahuszagh at gmail dot com
2021-04-19 10:40 ` redi at gcc dot gnu.org
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: ahuszagh at gmail dot com @ 2021-04-10 0:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Alexander Huszagh <ahuszagh at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ahuszagh at gmail dot com
--- Comment #13 from Alexander Huszagh <ahuszagh at gmail dot com> ---
Any chance we can merge the proposed patch on this? This still triggers in
GCC-10.2.1, and the proposed patch works if applied to both `sort()` and
`sort(cmp)` implementations in `include/bits/list.tcc`.
Version Info:
gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (6 preceding siblings ...)
2021-04-10 0:53 ` [Bug libstdc++/66742] abort on sorting list with custom allocator " ahuszagh at gmail dot com
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-04-27 11:37 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|redi at gcc dot gnu.org |unassigned at gcc dot gnu.org
Status|ASSIGNED |NEW
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (7 preceding siblings ...)
2021-04-19 10:40 ` redi at gcc dot gnu.org
@ 2021-04-27 11:37 ` jakub at gcc dot gnu.org
2021-05-25 20:52 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (8 preceding siblings ...)
2021-04-27 11:37 ` jakub at gcc dot gnu.org
@ 2021-05-25 20:52 ` redi at gcc dot gnu.org
2021-07-28 7:04 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-25 20:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed downstream in my fork:
https://gitlab.com/jonathan-wakely/gcc/-/commit/18d78721bf3afaed243252a01a4f4909c17531b2
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (9 preceding siblings ...)
2021-05-25 20:52 ` redi at gcc dot gnu.org
@ 2021-07-28 7:04 ` rguenth at gcc dot gnu.org
2021-10-01 19:40 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28 7:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |---
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (10 preceding siblings ...)
2021-07-28 7:04 ` rguenth at gcc dot gnu.org
@ 2021-10-01 19:40 ` cvs-commit at gcc dot gnu.org
2021-10-01 19:56 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-01 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
--- Comment #16 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:ff7793bea465019683b3a07d7ffceb6eae22def5
commit r12-4082-gff7793bea465019683b3a07d7ffceb6eae22def5
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue May 25 14:33:15 2021 +0100
libstdc++: Allow stateful allocators in std::list::sort [PR 66742]
The temporary lists used by std::list::sort are default constructed,
which means they use default constructed allocators. The sort operation
is defined in terms of merge and splice operations, which have undefined
behaviour (and abort) if the allocators do not compare equal. This means
it is not possible to sort a list that uses an allocator that compares
unequal to an default constructed allocator.
The solution is to avoid using temporary std::list objects at all. We do
not need to be able to allocate memory because no nodes are allocated,
only spliced from one list to another. That means the temporary lists
don't need an allocator at all, so whether it would compare equal
doesn't matter.
Instead of temporary std::list objects, we can just use a collection of
_List_node_base objects that nodes can be spliced onto as needed. Those
objects are wrapped in a _Scratch_list type that implements the splicing
and merging operations used by list::sort.
We also don't need to update the list size during the sort, because
sorting doesn't alter the number of nodes. Although we move nodes in and
out of the scratch lists, at the end of the function all nodes are back
in the original std::list and the scratch lists are empty. So for the
cxx11 ABI we can avoid the _M_size modifications usually done when
splicing nodes.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/66742
* include/bits/list.tcc (list::sort()): Use _Scratch_list
objects for splicing and merging.
(list::sort(StrictWeakOrdering)): Likewise.
* include/bits/stl_list.h (__detail::_Scratch_list): New type.
* src/c++98/list.cc (_List_node_base::_M_transfer): Add
assertion for --enable-libstdcxx-debug library.
* testsuite/23_containers/list/operations/66742.cc: New test.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (11 preceding siblings ...)
2021-10-01 19:40 ` cvs-commit at gcc dot gnu.org
@ 2021-10-01 19:56 ` redi at gcc dot gnu.org
2021-11-02 10:16 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-01 19:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (12 preceding siblings ...)
2021-10-01 19:56 ` redi at gcc dot gnu.org
@ 2021-11-02 10:16 ` redi at gcc dot gnu.org
2021-11-03 16:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-02 10:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
My fix caused a regression for this (IMHO dumb) case:
#include <list>
struct X {
bool operator<(X&) /* non-const */ { return false; }
};
struct Cmp {
bool operator()(X&, X&) /* non-const */ { return false; }
};
int main() {
std::list<X> l;
l.sort();
Cmp c;
l.sort(c);
}
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (13 preceding siblings ...)
2021-11-02 10:16 ` redi at gcc dot gnu.org
@ 2021-11-03 16:51 ` cvs-commit at gcc dot gnu.org
2022-05-06 8:29 ` jakub at gcc dot gnu.org
2022-05-06 12:30 ` redi at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-03 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
--- Comment #19 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:1e7a269856fd67aff78ac874bec96d31a54b2fd9
commit r12-4873-g1e7a269856fd67aff78ac874bec96d31a54b2fd9
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 2 10:21:01 2021 +0000
libstdc++: Fix regression in std::list::sort [PR66742]
The standard does not require const-correct comparisons in list::sort.
libstdc++-v3/ChangeLog:
PR libstdc++/66742
* include/bits/list.tcc (list::sort): Use mutable iterators for
comparisons.
* include/bits/stl_list.h (_Scratch_list::_Ptr_cmp): Likewise.
* testsuite/23_containers/list/operations/66742.cc: Check
non-const comparisons.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (14 preceding siblings ...)
2021-11-03 16:51 ` cvs-commit at gcc dot gnu.org
@ 2022-05-06 8:29 ` jakub at gcc dot gnu.org
2022-05-06 12:30 ` redi at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |12.2
--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug libstdc++/66742] abort on sorting list with custom allocator that is not stateless
2015-07-02 14:46 [Bug libstdc++/66742] New: abort on sorting list with custom compiler that is not stateless mdiluzio at feralinteractive dot com
` (15 preceding siblings ...)
2022-05-06 8:29 ` jakub at gcc dot gnu.org
@ 2022-05-06 12:30 ` redi at gcc dot gnu.org
16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-06 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
Target Milestone|12.2 |12.0
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This was fixed for 12.1
^ permalink raw reply [flat|nested] 18+ messages in thread