https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77582
--- Comment #1 from Cong Wang <xiyou.wangcong at gmail dot com> --- Created attachment 39614 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39614&action=edit A possible patch This patch improves it by using _S_empty_rep directly when _GLIBCXX_FULLY_DYNAMIC_STRING is not enabled.