This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[LTO] PATCH: Fix another segv triggered by null pointer dereference
- From: simonb at google dot com (Simon Baldwin)
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 Oct 2008 16:54:32 +0100 (BST)
- Subject: [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))