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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:43f4d44bebd63b354f8798fcef512d4d2b42c655

commit r15-6941-g43f4d44bebd63b354f8798fcef512d4d2b42c655
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Jan 16 09:17:50 2025 +0100

    vec.h: Properly destruct elements in auto_vec auto storage [PR118400]

    For T with non-trivial destructors, we were destructing objects in the
    vector on release only when not using auto storage of auto_vec.

    The following patch calls truncate (0) instead of m_vecpfx.m_num clearing,
    and truncate takes care of that destruction:
      unsigned l = length ();
      gcc_checking_assert (l >= size);
      if (!std::is_trivially_destructible <T>::value)
        vec_destruct (address () + size, l - size);
      m_vecpfx.m_num = size;

    2025-01-16  Jakub Jelinek  <ja...@redhat.com>

            PR ipa/118400
            * vec.h (vec<T, va_heap, vl_ptr>::release): Call m_vec->truncate
(0)
            instead of clearing m_vec->m_vecpfx.m_num.

Reply via email to