https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336#c1 contains a workaround
> for libstdc++

Maybe

      _GLIBCXX20_CONSTEXPR
      basic_string&
      assign(const _CharT* __s)
      {
        __glibcxx_requires_string(__s);
        return _M_replace(size_type(0), this->size(), __s,
                          traits_type::length(__s));
      }

isn't the most efficient way to assign a string (constant) looking at
the complexity of _M_replace and its overlap checks (that we all expect
to be optimized away but which are not).  In fact the _M_disjunct check
isn't optimized because we cannot tell if the std::string storage
overlaps the constant pool ...

Reply via email to