Patchwork Fix Bug 51162

login
register
mail settings
Submitter Sameera Deshpande
Date Dec. 2, 2011, 11:15 a.m.
Message ID <1322824515.2525.8.camel@e102549-lin.cambridge.arm.com>
Download mbox | patch
Permalink /patch/128824/
State New
Headers show

Comments

Sameera Deshpande - Dec. 2, 2011, 11:15 a.m.
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.

--
Jason Merrill - Dec. 2, 2011, 2:35 p.m.
OK.

Jason

Patch

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);