On Wed, 2011-11-30 at 19:43 +0000, Jason Merrill wrote:
> On 11/24/2011 05:42 AM, Sameera Deshpande wrote:
> > - 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
>
> I'd rather not add the null check so many times. How about just
> returning if fn is null?
>
> Jason
>
Jason,
Thanks for your comment.
Please find attached reworked patch returning if fn is NULL.
the patch is tested with check-gcc for ARM.
--
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f0e7c50..3b5f670 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -698,6 +698,9 @@ dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
if (gimple_call_tail_p (gs))
pp_string (buffer, " [tail call]");
+ if (fn == NULL)
+ return;
+
/* Dump the arguments of _ITM_beginTransaction sanely. */
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);