[03/13] tree-inline decl_map: skip mapping NULL to itself

Message ID orsfh1fpgc.fsf@lxoliva.fsfla.org
State Accepted
Headers
Series [01/13] scoped tables: insert before further lookups |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Alexandre Oliva Dec. 27, 2022, 4:19 a.m. UTC
  Mapping a NULL key is no use, skip it.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

	* tree-inline.cc (insert_decl_map): Skip mapping a NULL decl
	as value to itself.
---
 gcc/tree-inline.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law Dec. 27, 2022, 3:15 p.m. UTC | #1
On 12/26/22 21:19, Alexandre Oliva via Gcc-patches wrote:
> 
> Mapping a NULL key is no use, skip it.
> 
> Regstrapped on x86_64-linux-gnu.  Ok to install?
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-inline.cc (insert_decl_map): Skip mapping a NULL decl
> 	as value to itself.
OK
jeff
  

Patch

diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index c6c86af6c4ea9..bfea1cc11822e 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -148,7 +148,7 @@  insert_decl_map (copy_body_data *id, tree key, tree value)
 
   /* Always insert an identity map as well.  If we see this same new
      node again, we won't want to duplicate it a second time.  */
-  if (key != value)
+  if (key != value && value)
     id->decl_map->put (value, value);
 }