[Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 29 15:14:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 15:13:57 UTC ---
Thus, I guess the right thing to do is sort-of the other way around of what I
was thinking: change _M_disjunct in such a way that when the destination is the
empty rep it always returns true, thus we first allocate memory for the
destination and then copy the '\0' to it and everything is fine (nothing bad
can happen to the source in this special case because the empty rep source
isn't in dynamically allocated memory, thus isn't deallocated, it stays in
memory forever).



More information about the Gcc-bugs mailing list