public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mdiluzio at feralinteractive dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless
Date: Fri, 03 Jul 2015 08:14:00 -0000	[thread overview]
Message-ID: <bug-66742-4-ajS75QzakA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66742-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2015-07-03  8:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 14:46 [Bug libstdc++/66742] New: " 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 [this message]
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
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
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
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
2022-05-06  8:29 ` jakub at gcc dot gnu.org
2022-05-06 12:30 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66742-4-ajS75QzakA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).