https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118400
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This looks like a serious vec.h bug to me.
avals->m_known_value_ranges member is auto_vec<value_range, 32>.
ipa-fnsummary.cc does on that
if (!avals->m_known_value_ranges.length ())
{
avals->m_known_value_ranges.safe_grow_cleared
(count,
true);
for (int i = 0; i < count; ++i)
avals->m_known_value_ranges[i].set_type
(void_type_node);
}
avals->m_known_value_ranges[i] = vr;
count seems to be 4, so it uses the auto storage, and safe_gro_cleared there
vec_default_construct constructs 4 objects.
But ~auto_vec calls
this->release ();
and that does
template<typename T>
inline void
vec<T, va_heap, vl_ptr>::release (void)
{
if (!m_vec)
return;
if (using_auto_storage ())
{
m_vec->m_vecpfx.m_num = 0;
return;
}
va_heap::release (m_vec);
}
where va_heap::release does
if (!std::is_trivially_destructible <T>::value)
vec_destruct (v->address (), v->length ());
but for the using_auto_storage case we don't do that.