This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[LTO] PATCH: Fix another segv triggered by null pointer dereference


Another small patch, this time to fix a segv arising in cc1 with -fwhopr, where
TREE_CODE() is otherwise taken on a NULL_TREE.  Okay?  Thanks.


gcc/lto/ChangeLog
2008-10-20  Simon Baldwin  <simonb@google.com>

	* lto-symtab.c: (lto_same_type_p): Types cannot be equal if one of
	them is NULL (but not the other).


Index: gcc/lto/lto-symtab.c
===================================================================
--- gcc/lto/lto-symtab.c	(revision 141192)
+++ gcc/lto/lto-symtab.c	(working copy)
@@ -44,6 +44,10 @@ lto_same_type_p (tree type_1, tree type_
   if (type_1 == type_2)
     return true;
 
+  /* Check that we have two types to compare.  */
+  if (type_1 == NULL_TREE || type_2 == NULL_TREE)
+    return false;
+
   /* Can't be the same type if the types don't have the same code.  */
   code = TREE_CODE (type_1);
   if (code != TREE_CODE (type_2))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]