https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336
Mattias Ellert <mattias.ellert at physics dot uu.se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mattias.ellert at physics dot uu.s | |e --- Comment #1 from Mattias Ellert <mattias.ellert at physics dot uu.se> --- Created attachment 52872 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52872&action=edit Proposed fix Proposed fix: ``` {.diff} --- usr/include/c++/12/bits/basic_string.tcc.orig 2022-04-14 01:23:43.000000000 +0200 +++ usr/include/c++/12/bits/basic_string.tcc 2022-04-25 16:18:57.028352162 +0200 @@ -527,10 +527,10 @@ } else { - const size_type __nleft = (__p + __len1) - __s; - this->_S_move(__p, __s, __nleft); - this->_S_copy(__p + __nleft, __p + __len2, - __len2 - __nleft); + const size_type __nleft = (__s + __len2) - (__p + __len1); + this->_S_move(__p, __s, __len2 - __nleft); + this->_S_copy(__p + __len2 - __nleft, __p + __len2, + __nleft); } } } ```