public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "potswa at mac dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/55409] std::list not properly wrapping access to custom allocator through allocator_traits
Date: Wed, 17 Jun 2015 21:20:00 -0000	[thread overview]
Message-ID: <bug-55409-4-Vhe7XNSZpk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55409-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55409

--- Comment #13 from David Krauss <potswa at mac dot com> ---
Nice!

Just a few things:

1. Line 304: rebind isn’t an official member of allocator_traits. Prefer
rebind_alloc.

2. _M_put_node is assuming no fancy pointers: its parameter is a
_Node_alloc_traits::pointer but its argument is a _Node*. I think the intent
with fancy pointers is that they get stored in nodes, but doing so would change
the ABI for fancy pointers that implicitly convert to raw. Perhaps that’s
acceptable, with these sweeping changes?

3. Line 554: should call _Node_alloc_traits::construct. (This breaks allocators
which need a rebind to do construction, but so does the C++11 standard. To be
both backward- and forward-compatible would require rebinding, converting,
constructing via traits, converting back, and assigning. According to my
reading, anyway.) For what it’s worth, the revision already uses
_Node_alloc_traits::destroy, although that’s customized less in practice.
>From gcc-bugs-return-489255-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 17 21:58:44 2015
Return-Path: <gcc-bugs-return-489255-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28597 invoked by alias); 17 Jun 2015 21:58:44 -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 28246 invoked by uid 48); 17 Jun 2015 21:58:39 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/55409] std::list not properly wrapping access to custom allocator through allocator_traits
Date: Wed, 17 Jun 2015 21:58:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.7.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-55409-4-q4D1d8eYF7@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55409-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55409-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-06/txt/msg01587.txt.bz2
Content-length: 2043

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55409

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to David Krauss from comment #13)
> 1. Line 304: rebind isn’t an official member of allocator_traits. Prefer
> rebind_alloc.

That isn't allocator_traits, it's __gnu_cxx::__alloc_traits, which is a
compatibility layer that works the same in C++03 and C++11. It has rebind, not
rebind_alloc, see <ext/alloc_traits.h>

> 2. _M_put_node is assuming no fancy pointers: its parameter is a
> _Node_alloc_traits::pointer but its argument is a _Node*. I think the intent
> with fancy pointers is that they get stored in nodes,

I agree it's desirable, but it's not really clear that it's required, see
http://cplusplus.github.io/LWG/lwg-active.html#2261

> but doing so would
> change the ABI for fancy pointers that implicitly convert to raw. Perhaps
> that’s acceptable, with these sweeping changes?

These changes shouldn't affect the ABI. 

I have patches coming some time for fancy pointers in all containers, for
PR57272, which also don't affect the ABI. My plan is to use the existing node
types for allocators without fancy pointers, but use a new family of types
(_List_ptr_node, _List_ptr_iterator etc.) that use fancy pointers. That will
preserve ABI compatibility for non-fancy pointers, but also fully support fancy
pointers. But it's a lot of work, due to the backward-compatibility
requirements.

> 3. Line 554: should call _Node_alloc_traits::construct. (This breaks
> allocators which need a rebind to do construction, but so does the C++11
> standard. To be both backward- and forward-compatible would require
> rebinding, converting, constructing via traits, converting back, and
> assigning. According to my reading, anyway.) For what it’s worth, the
> revision already uses _Node_alloc_traits::destroy, although that’s
> customized less in practice.

Line 504 is only compiled in C++98 mode, where allocators are required to
provide a construct member.
>From gcc-bugs-return-489256-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 17 22:18:18 2015
Return-Path: <gcc-bugs-return-489256-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 62259 invoked by alias); 17 Jun 2015 22:18:18 -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 62231 invoked by uid 48); 17 Jun 2015 22:18:14 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/57272] node-based containers don't use allocator's pointer type internally
Date: Wed, 17 Jun 2015 22:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57272-4-SN8u1B8vsa@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57272-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57272-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-06/txt/msg01588.txt.bz2
Content-length: 176

https://gcc.gnu.org/bugzilla/show_bug.cgi?idW272

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
c.f. http://cplusplus.github.io/LWG/lwg-active.html#2261


  parent reply	other threads:[~2015-06-17 21:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20  8:51 [Bug libstdc++/55409] New: " benjamin.kircher at gmail dot com
2012-11-20  9:13 ` [Bug libstdc++/55409] " redi at gcc dot gnu.org
2012-11-20  9:25 ` redi at gcc dot gnu.org
2012-11-20  9:31 ` benjamin.kircher at gmail dot com
2012-11-20 10:30 ` redi at gcc dot gnu.org
2014-09-02 19:11 ` freddie_chopin at op dot pl
2014-09-03  4:27 ` redi at gcc dot gnu.org
2014-09-03  6:35 ` freddie_chopin at op dot pl
2014-09-03 11:20 ` redi at gcc dot gnu.org
2015-04-10 14:42 ` redi at gcc dot gnu.org
2015-04-10 14:42 ` redi at gcc dot gnu.org
2015-06-16 16:29 ` redi at gcc dot gnu.org
2015-06-17 20:37 ` redi at gcc dot gnu.org
2015-06-17 21:20 ` potswa at mac dot com [this message]
2015-06-17 22:20 ` potswa at mac dot com
2015-09-10 20: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-55409-4-Vhe7XNSZpk@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).