Patchwork [mem-ref2] More fancy dumping

login
register
mail settings
Submitter Richard Guenther
Date June 9, 2010, 1:10 p.m.
Message ID <alpine.LNX.2.00.1006091509240.1429@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/55090/
State New
Headers show

Comments

Richard Guenther - June 9, 2010, 1:10 p.m.
This fixes spurious testsuite FAILs in C++ that occur because we
do not do fancy printing when referece vs. pointer types occur.

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

Richard.

2010-06-09  Richard Guenther  <rguenther@suse.de>

	* tree-pretty-print.c (dump_generic_node): Ignore pointer
	vs. reference type when doing fancy MEM_REF dumping.

Patch

Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c	(revision 160437)
+++ gcc/tree-pretty-print.c	(working copy)
@@ -797,8 +797,17 @@  dump_generic_node (pretty_printer *buffe
     case MEM_REF:
       {
 	if (integer_zerop (TREE_OPERAND (node, 1))
-	    && (TREE_TYPE (TREE_OPERAND (node, 0))
-		== TREE_TYPE (TREE_OPERAND (node, 1)))
+	    /* Same pointer types, but ignoring POINTER_TYPE vs.
+	       REFERENCE_TYPE.  */
+	    && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
+		== TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
+	    && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
+		== TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
+	    && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
+		== TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
+	    && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 0)))
+		== TYPE_QUALS (TREE_TYPE (TREE_OPERAND (node, 1))))
+	    /* Same value types ignoring qualifiers.  */
 	    && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
 		== TYPE_MAIN_VARIANT
 		    (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))))
@@ -1145,8 +1154,17 @@  dump_generic_node (pretty_printer *buffe
 	      || (TREE_CODE (op0) == MEM_REF
 		  && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
 		  && integer_zerop (TREE_OPERAND (op0, 1))
-		  && (TREE_TYPE (TREE_OPERAND (op0, 0))
-		      == TREE_TYPE (TREE_OPERAND (op0, 1)))
+		  /* Same pointer types, but ignoring POINTER_TYPE vs.
+		     REFERENCE_TYPE.  */
+		  && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
+		      == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
+		  && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
+		      == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
+		  && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
+		      == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
+		  && (TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 0)))
+		      == TYPE_QUALS (TREE_TYPE (TREE_OPERAND (op0, 1))))
+		  /* Same value types ignoring qualifiers.  */
 		  && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
 		      == TYPE_MAIN_VARIANT
 		          (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))