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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-03-28

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This one can be fixed by telling the compiler that when the vector has unused
capacity, the end() iterator is not null:

--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -768,6 +768,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER

          if (__navail >= __n)
            {
+             if (!this->_M_impl->_M_finish)
+               __builtin_unreachable();
+
              _GLIBCXX_ASAN_ANNOTATE_GROW(__n);
              this->_M_impl._M_finish =
                std::__uninitialized_default_n_a(this->_M_impl._M_finish,
  • [Bug tree-optimization/114945] ... redi at gcc dot gnu.org via Gcc-bugs

Reply via email to