public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/30578]  New: array_allocator can't be safely copied
@ 2007-01-24 20:00 skottmckay at gmail dot com
  2007-01-24 20:02 ` [Bug libstdc++/30578] " skottmckay at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: skottmckay at gmail dot com @ 2007-01-24 20:00 UTC (permalink / raw)
  To: gcc-bugs

The current implementation of the array_allocator allows the allocator to be
copy constructed. This leads to trouble due to _M_used, which is not
synchronized between the copies. Each copy will start allocating from the same
point in the underlying array.


-- 
           Summary: array_allocator can't be safely copied
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: skottmckay at gmail dot com


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


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

* [Bug libstdc++/30578] array_allocator can't be safely copied
  2007-01-24 20:00 [Bug libstdc++/30578] New: array_allocator can't be safely copied skottmckay at gmail dot com
@ 2007-01-24 20:02 ` skottmckay at gmail dot com
  2007-02-01 12:20 ` bkoz at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: skottmckay at gmail dot com @ 2007-01-24 20:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from skottmckay at gmail dot com  2007-01-24 20:02 -------
Created an attachment (id=12950)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12950&action=view)
Example code showing overwriting of array when copied.


-- 


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


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

* [Bug libstdc++/30578] array_allocator can't be safely copied
  2007-01-24 20:00 [Bug libstdc++/30578] New: array_allocator can't be safely copied skottmckay at gmail dot com
  2007-01-24 20:02 ` [Bug libstdc++/30578] " skottmckay at gmail dot com
@ 2007-02-01 12:20 ` bkoz at gcc dot gnu dot org
  2007-02-01 13:01 ` bkoz at gcc dot gnu dot org
  2007-02-07 21:58 ` skottmckay at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-02-01 12:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bkoz at gcc dot gnu dot org  2007-02-01 12:20 -------

Should array_allocator be copy-constructable? I am not sure that the extra
effort to make _M_used shared in a mt-safe manner is worth it, for something
that is supposed to be write-once memory. 

This is a deviation from the normal allocator interface, though.

Interesting.


-- 


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


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

* [Bug libstdc++/30578] array_allocator can't be safely copied
  2007-01-24 20:00 [Bug libstdc++/30578] New: array_allocator can't be safely copied skottmckay at gmail dot com
  2007-01-24 20:02 ` [Bug libstdc++/30578] " skottmckay at gmail dot com
  2007-02-01 12:20 ` bkoz at gcc dot gnu dot org
@ 2007-02-01 13:01 ` bkoz at gcc dot gnu dot org
  2007-02-07 21:58 ` skottmckay at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-02-01 13:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

bkoz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-01 13:01:04
               date|                            |


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


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

* [Bug libstdc++/30578] array_allocator can't be safely copied
  2007-01-24 20:00 [Bug libstdc++/30578] New: array_allocator can't be safely copied skottmckay at gmail dot com
                   ` (2 preceding siblings ...)
  2007-02-01 13:01 ` bkoz at gcc dot gnu dot org
@ 2007-02-07 21:58 ` skottmckay at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: skottmckay at gmail dot com @ 2007-02-07 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from skottmckay at gmail dot com  2007-02-07 21:58 -------
Doesn't it need to be copy constructable for the rebinding to work for
_Vector_base::_Vector_impl::_Tp_alloc_type?

I agree that making it mt-safe doesn't quite fit with its intended usage.

Possibly the array_allocator and backing array should be wrapped with a
non-copyable class. 


-- 


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


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

end of thread, other threads:[~2007-02-07 21:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-24 20:00 [Bug libstdc++/30578] New: array_allocator can't be safely copied skottmckay at gmail dot com
2007-01-24 20:02 ` [Bug libstdc++/30578] " skottmckay at gmail dot com
2007-02-01 12:20 ` bkoz at gcc dot gnu dot org
2007-02-01 13:01 ` bkoz at gcc dot gnu dot org
2007-02-07 21:58 ` skottmckay at gmail dot com

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