Hi,

Please find attached the patch fixing bugzilla issue
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51162.

ARM architecture implements vec_[load|store]_lanes<mode><mode> which are
implemented as internal function calls. The function gimple_call_fn ()
returns NULL for internal calls. Hence, this patch guards dereferences
of 'fn' in dump_gimple_call ().

Tests in gcc-dg/vect failing with 'segmentation fault', pass with this
patch.

gcc/Changelog entry:
2011-11-24  Sameera Deshpande  <sameera.deshpa...@arm.com>

       * gimple-pretty-print.c (dump_gimple_call): Check if fn is NULL
         before dereferencing.

-- 
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f0e7c50..6d96868 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -699,11 +699,12 @@ dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
     pp_string (buffer, " [tail call]");
 
   /* Dump the arguments of _ITM_beginTransaction sanely.  */
-  if (TREE_CODE (fn) == ADDR_EXPR)
+  if (fn != NULL && TREE_CODE (fn) == ADDR_EXPR)
     fn = TREE_OPERAND (fn, 0);
-  if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
+  if (fn != NULL && TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
     pp_string (buffer, " [tm-clone]");
-  if (TREE_CODE (fn) == FUNCTION_DECL
+  if (fn != NULL
+      && TREE_CODE (fn) == FUNCTION_DECL
       && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
       && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
       && gimple_call_num_args (gs) > 0)

Reply via email to