public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor
@ 2005-05-16 16:24 pcarlini at suse dot de
  2005-05-16 16:31 ` [Bug libstdc++/21609] " pcarlini at suse dot de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-05-16 16:24 UTC (permalink / raw)
  To: gcc-bugs

There is an issue with array_allocator, which clearly surfaced while working
on libstdc++/19495. In a nutshell, the templated copy-constructor doesn't seem to
play well with rebinds: after a rebind, the first copy-constructor call leads
to _M_array = 0 and no memory can be possibly returned by allocate. This makes
sense, because the underlying array probably is inappropriate for a type !=
the orginal one (because of alignment requirements, at least), but leads to an
allocator much less usable in general applications.

-- 
           Summary: array_allocator vs rebind & copy-constructor
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pcarlini at suse dot de
                CC: bkoz at redhat dot com,gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & copy-constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
@ 2005-05-16 16:31 ` pcarlini at suse dot de
  2005-05-16 17:41 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-05-16 16:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-16 16:30 -------
Forgot to say: probably the issue can be dealt with at the cost of increasing
its complexity. Logic could be added to the copy-constructor(s) to the effect
of keeping on using the existing allocated memory, i.e., not zeroing _M_array
in the templated copy-contructor. This would make sense only when the alignment
is still appropriate for the new type: this check could be either responsability
of the user or enforced by the allocator (more tricky).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & copy-constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
  2005-05-16 16:31 ` [Bug libstdc++/21609] " pcarlini at suse dot de
@ 2005-05-16 17:41 ` pinskia at gcc dot gnu dot org
  2005-05-16 17:51 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor pcarlini at suse dot de
  2005-05-16 18:24 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 17:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-16 17:41 -------
Templates are never copy constructors.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
  2005-05-16 16:31 ` [Bug libstdc++/21609] " pcarlini at suse dot de
  2005-05-16 17:41 ` pinskia at gcc dot gnu dot org
@ 2005-05-16 17:51 ` pcarlini at suse dot de
  2005-05-16 18:24 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-05-16 17:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-16 17:51 -------
Yes, sorry ;) (12.8). Summary fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|array_allocator vs rebind & |array_allocator vs rebind &
                   |copy-constructor            |templated constructor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
                   ` (2 preceding siblings ...)
  2005-05-16 17:51 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor pcarlini at suse dot de
@ 2005-05-16 18:24 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 18:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-16 18:24 -------
(In reply to comment #2)
> Templates are never copy constructors.

Just to clarify just in case some mistakes this for something different.
template member functions cannot be considered a copy constructor.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-05-16 18:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
2005-05-16 16:31 ` [Bug libstdc++/21609] " pcarlini at suse dot de
2005-05-16 17:41 ` pinskia at gcc dot gnu dot org
2005-05-16 17:51 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor pcarlini at suse dot de
2005-05-16 18:24 ` pinskia at gcc dot gnu dot org

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).