[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

2021-11-14 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103229

Aldy Hernandez  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Aldy Hernandez  ---
fixed

[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

2021-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103229

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Aldy Hernandez :

https://gcc.gnu.org/g:a7ef5da3a9c348c35abb72d6f64f209f5661cfa4

commit r12-5242-ga7ef5da3a9c348c35abb72d6f64f209f5661cfa4
Author: Aldy Hernandez 
Date:   Sun Nov 14 11:27:32 2021 +0100

Do not pass NULL to memset in ssa_global_cache.

The code computing ranges in PHIs in the path solver reuses the
temporary ssa_global_cache by calling its clear method.  Calling it on
an empty cache causes us to call memset with NULL.

Tested on x86-64 Linux.

gcc/ChangeLog:

PR tree-optimization/103229
* gimple-range-cache.cc (ssa_global_cache::clear): Do not pass
null value to memset.

gcc/testsuite/ChangeLog:

* gcc.dg/pr103229.c: New test.

[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

2021-11-14 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103229

--- Comment #2 from Aldy Hernandez  ---
(In reply to Aldy Hernandez from comment #1)
> Untested, but if someone wants to test and commit, feel free.

Nevermind, I'll pass it through the gauntlet and commit.

[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

2021-11-14 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103229

--- Comment #1 from Aldy Hernandez  ---
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.

[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

2021-11-14 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103229

Martin Liška  changed:

   What|Removed |Added

  Known to fail||12.0
   Last reconfirmed||2021-11-14
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Target Milestone|--- |12.0
   Priority|P3  |P1