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]

[PATCH] Fix PR target/48807


Hi,
The attached patch is a fix for PR/48807, which is a segfault when compiling the bfin compiler.  The problem appears to be that we're not checking the return value of cgraph_local_info for null before attempting to dereference it.  This wasn't a problem before, but now cgraph_local_info calls cgraph_get_node (instead of the old cgraph_node), we cannot assume it will always return non-null.

Fix is in bfin specific code.

Ok to commit to trunk?

Stu


2011-05-06  Stuart Henderson  <shenders@gcc.gnu.org>

    * config/bfin/bfin.c: Check return value of cgraph_local_info for null before
        attempting to use it.




Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c      (revision 173363)
+++ gcc/config/bfin/bfin.c      (working copy)
@@ -2077,6 +2077,8 @@

   this_func = cgraph_local_info (current_function_decl);
   called_func = cgraph_local_info (decl);
+  if (!called_func || !this_func)
+    return false;
   return !called_func->local || this_func->local;
 }






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