This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/31370] resizing bugs in std::vector
- From: "gcc at severeweblint dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Mar 2007 03:20:49 -0000
- Subject: [Bug libstdc++/31370] resizing bugs in std::vector
- References: <bug-31370-14320@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from gcc at severeweblint dot org 2007-03-27 04:20 -------
Created an attachment (id=13293)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13293&action=view)
patch
This patch fixes all the problems in the cheapest possible way. With it the
attached testcase succeedds. It does not incorporate the testcase attachment
into the gcc testsuite, although that surely ought to be done. (I got confused
by the makefile for the testsuite. sorry)
Note there are other approaches to fixing these bugs that might be better in
the long term:
1) It is plainly bad that vector<bool> has a copy of code from vector. It is
likewise poor that each has 3 places that deal in resizing, each of which needs
similar defensive logic.
2) vector<bool>::iterator ought to use a 64-bit int for sizes, even in a 32-bit
environment, since it could have sizes larger than the pointer limitation. But
I'm not positive that that is doable. It may not be possible to match function
signatures to vector as needed. The limited size may be best considered a cost
of the mistake of making a bit vector a specialization of vector, instead of
its own class.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31370