[Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::append() fails to update length
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 28 18:10:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-28 18:10:13 UTC ---
(In reply to comment #1)
> It is caused by revision 148850:
>
> http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00833.html
That patch fixed a race condition, and it *is* correct to prevent writes to the
empty shared rep. If we reverted that patch we'd reintroduce the race, and
still erroneously write to the empty rep.
The underlying bug is in string::append() where it tries to write to it in the
first place. I think as well as checking _M_disjunct(__s) and _M_is_shared() we
should check whether we have the empty rep.
More information about the Gcc-bugs
mailing list