deque fails to meet 23.2.1.3.4-5 causing invalid iterators and extra assignments
Paolo Carlini
pcarlini@suse.de
Tue Jan 23 23:15:00 GMT 2007
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.
More information about the Libstdc++
mailing list