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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This change to bits/basic_string.h seems to shut the compiler up:

--- include/bits/basic_string.h 2023-02-27 13:42:21.295513537 +0000
@@ -271,7 +271,15 @@
       _GLIBCXX20_CONSTEXPR
       bool
       _M_is_local() const
-      { return _M_data() == _M_local_data(); }
+      {
+        if (_M_data() == _M_local_data())
+          {
+            if (_M_string_length > _S_local_capacity)
+              __builtin_unreachable();
+            return true;
+          }
+        return false;
+      }

       // Create & Destroy
       _GLIBCXX20_CONSTEXPR

Reply via email to