This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/26875] New: Array allocator use count is shared between array_allocator instances
- From: "bart dot vanassche at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Mar 2006 09:30:57 -0000
- Subject: [Bug libstdc++/26875] New: Array allocator use count is shared between array_allocator instances
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Although not explicitly documented, I expect different array allocator objects
to behave independently of each other - each array allocator should manage its
own storage. Allocating memory via one array allocator should not have any
effect on the internal state of another array allocator object. What I saw in
the header <ext/array_allocator.h> is that all array allocators for given types
_Tp and _Array share the variable __array_used since it's declared static in
array_allocator<>::allocate(). This causes interactions between
array_allocator<> objects and additionally this is certainly not a thread-safe
approach !
The attached test code throws std::bad_alloc while it should not throw any
exceptions.
--
Summary: Array allocator use count is shared between
array_allocator instances
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bart dot vanassche at gmail dot com
GCC build triplet: i586-suse-linux
GCC host triplet: i586-suse-linux
GCC target triplet: i586-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26875