Hi,

pr61510 is a case where cgraphunit.c::analyze_functions can end up
dereferencing a NULL pointer. This is, to me, the obvious way to avoid
dereferencing NULL.

However, I'm not very confident that this isn't just masking some
horrible and subtle bug, so I'd like some review feedback on the patch.

Tested on aarch64-none-elf, where I was seeing the issue.

OK?

Thanks,
James

---
2014-06-19  James Greenhalgh  <james.greenha...@arm.com>

        PR regression/61510
        * cgraphunit.c (analyze_functions): Check we have an origin
        node before dereferencing it.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 1b7ab33..82e5a68 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1051,7 +1051,8 @@ analyze_functions (void)
 		{
 		  struct cgraph_node *origin_node
 	    	  = cgraph_get_node (DECL_ABSTRACT_ORIGIN (decl));
-		  origin_node->used_as_abstract_origin = true;
+		  if (origin_node)
+		    origin_node->used_as_abstract_origin = true;
 		}
 	    }
 	  else

Reply via email to