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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This fixes the minimal reproducer in comment 1:

--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
@@ -138,7 +138,7 @@ erase_imp(It it)
 #endif

   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
-  value_vector a_values = s_value_alloc.allocate(m_size - 1);
+  value_vector a_values = m_size > 1 ? s_value_alloc.allocate(m_size - 1) : 0;
   iterator source_it = begin();
   iterator source_end_it = end();
   iterator target_it = a_values;

This means that we are left with a null m_a_entries when erasing the last
element.

I don't know if that's correct though, there might be other code which relies
on the current non-null pointer.

Reply via email to