Patchwork Fix PR44911

login
register
mail settings
Submitter Richard Guenther
Date July 13, 2010, 11:06 a.m.
Message ID <alpine.LNX.2.00.1007131305080.1429@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/58765/
State New
Headers show

Comments

Richard Guenther - July 13, 2010, 11:06 a.m.
This fixes multi-line output from dumping MEM_REF and also crashes
from endless recursions of TYPE_DECLs without a name.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

2010-07-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44911
	* tree-pretty-print.c (dump_generic_node): Use TDF_SLIM for
	MEM_REF pointer type dumping.  Avoid recursing for TYPE_DECLs
	without name.

Patch

Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c	(revision 162126)
+++ gcc/tree-pretty-print.c	(working copy)
@@ -828,7 +828,7 @@  dump_generic_node (pretty_printer *buffe
 	    pp_string (buffer, "MEM[");
 	    pp_string (buffer, "(");
 	    dump_generic_node (buffer, TREE_TYPE (TREE_OPERAND (node, 1)),
-			       spc, flags, false);
+			       spc, flags | TDF_SLIM, false);
 	    pp_string (buffer, ")");
 	    dump_generic_node (buffer, TREE_OPERAND (node, 0),
 			       spc, flags, false);
@@ -1113,7 +1113,7 @@  dump_generic_node (pretty_printer *buffe
 	}
       if (DECL_NAME (node))
 	dump_decl_name (buffer, node, flags);
-      else
+      else if (TYPE_NAME (TREE_TYPE (node)) != node)
 	{
 	  if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
 	       || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
@@ -1132,6 +1132,8 @@  dump_generic_node (pretty_printer *buffe
 	      dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
 	    }
 	}
+      else
+	pp_string (buffer, "<anon>");
       break;
 
     case VAR_DECL: