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 segv triggered by null pointer dereference


Small patch to fix segv arising in cc1 with -flto.  Okay?  Thanks.


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

	* langhooks.c: (lhd_print_error_function): Avoid accessing
	TREE_CODE(block) where block is NULL.


Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 141107)
+++ gcc/langhooks.c	(working copy)
@@ -427,7 +427,7 @@ lhd_print_error_function (diagnostic_con
 		  while (block && TREE_CODE (block) == BLOCK)
 		    block = BLOCK_SUPERCONTEXT (block);
 
-		  if (TREE_CODE (block) == FUNCTION_DECL)
+		  if (block && TREE_CODE (block) == FUNCTION_DECL)
 		    fndecl = block;
 		  abstract_origin = NULL;
 		}


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