This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/31370] resizing bugs in std::vector



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]