The following makes vec::splice of an empty vector to an empty
vector safe without falling onto the trap of invoking a method
on a NULL m_vec.

Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Richard.

2018-11-06  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/86850
        * vec.h (vec<T, va_heap, vl_ptr>::splice): Check src.length ()
        instead of src.m_vec.

diff --git a/gcc/vec.h b/gcc/vec.h
index f8c039754d2..407269c5ad3 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1688,7 +1688,7 @@ template<typename T>
 inline void
 vec<T, va_heap, vl_ptr>::splice (const vec<T, va_heap, vl_ptr> &src)
 {
-  if (src.m_vec)
+  if (src.length ())
     m_vec->splice (*(src.m_vec));
 }
 

Reply via email to