This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: deque fails to meet 23.2.1.3.4-5 causing invalid iterators and extra assignments


Steve LoBasso wrote:

Speaking relative to 4.2.0 is fine, as far as I can tell, this bug exists
in all versions of gnu deque as far back as I can see. In fact I see the
same problem in the SGI implementation. It seems to be an old bug and must
have been copied MANY times into MANY implementations.


Exactly, personally I saw that pattern so many times...

These seem to be the main issues:
the one extra copy and at the same time copying in the wrong direction,
thus invalidating the iterators. I can't see any other problems.

Although it is a problem more often than when n = size() - 1
ie. size() = 8 erase(begin() + 3, begin() + 4)


I see, in such cases we don't have a problem with 23.2.1.3/4, still we have one with /5.

I believe your fix is just as valid as mine. Either one seems to fix the problem.


Excellent, I will soon commit a fix together with your 2nd testcase, which is very small (we have to pay attention to your Copyleft rules...) and fully deterministic, should be enough.

Thanks again,
Paolo.


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