[Bug libstdc++/81338] stringstream remains empty after being moved into multiple times
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 6 15:00:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81338
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem is that basic_stringbuf::overflow assumes that if pptr() == epptr()
then we need to reallocate.
After a move we might have pptr() == epptr() but also have unused capacity in
the string. We should move epptr() to use that capacity, instead we reallocate
to double the string's capacity, which keeps trying to allocate bigger and
bigger buffers until allocation fails.
More information about the Gcc-bugs
mailing list