[Bug tree-optimization/103229] gcc/gimple-range-cache.cc:654:10: runtime error: null pointer passed as argument 1, which is declared to never be null

aldyh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Nov 14 10:15:06 GMT 2021


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

--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Untested, but if someone wants to test and commit, feel free.

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index a63e20e7e49..b347edeb474 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -651,7 +651,8 @@ ssa_global_cache::clear_global_range (tree name)
 void
 ssa_global_cache::clear ()
 {
-  memset (m_tab.address(), 0, m_tab.length () * sizeof (irange *));
+  if (m_tab.address ())
+    memset (m_tab.address(), 0, m_tab.length () * sizeof (irange *));
 }

 // Dump the contents of the global cache to F.


More information about the Gcc-bugs mailing list