From patchwork Wed Jun 9 13:10:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [mem-ref2] More fancy dumping Date: Wed, 09 Jun 2010 03:10:25 -0000 From: Richard Guenther X-Patchwork-Id: 55090 Message-Id: To: gcc-patches@gcc.gnu.org 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 * tree-pretty-print.c (dump_generic_node): Ignore pointer vs. reference type when doing fancy MEM_REF dumping. 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))))))))