From patchwork Fri Sep 10 23:01:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR,debug/45130] fix MEM_REF -fcompare-debug regression Date: Fri, 10 Sep 2010 13:01:34 -0000 From: Alexandre Oliva X-Patchwork-Id: 64476 Message-Id: To: "H.J. Lu" Cc: Richard Guenther , gcc-patches@gcc.gnu.org On Sep 8, 2010, "H.J. Lu" wrote: > This may have caused: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45604 Thanks. Indeed, it did. Sorry that I didn't catch this, I seem to have used an already-broken baseline for the regression testing. In spite of the comments above, I missed that we're not to issue a type cast between pointer-to-T and reference-to-T, or vice-versa. I implemented a test to cover that exception, but then I realized that, once we know we have pointer-to-T or reference-to-T, it doesn't matter, for purposes of tree dumping, whether the actual pointer types are even related, does it? Indeed, I checked that, once these cases were covered, we'd never get a hit. Turns out I caught one case in Ada and two in the C++ part of libjava. I only investigated the Ada one, and in that case we had two types, each its own main type variant, that were AFAICT identical pointer types to the same type. The tree dump for both types was bitwise identical. I took this as confirmation that comparing the top-level type of the two operands of MEM_REFs, after comparing the pointed-to-types, buys us nothing. Richi, does this look right? If so, this patch fixes the testsuite regressions, and cleans up other unnecessary tree-dump changes that my previous patch introduced. Ok to install? Regstrapped on x86_64-linux-gnu and i686-linux-gnu. for gcc/ChangeLog from Alexandre Oliva PR debug/45604 PR debug/45419 PR debug/45408 * tree-pretty-print.c (dump_generic_node): Disregard top-level types of MEM_REF pointer types to the same type. Index: gcc/tree-pretty-print.c =================================================================== --- gcc/tree-pretty-print.c.orig 2010-09-09 14:46:57.193300054 -0300 +++ gcc/tree-pretty-print.c 2010-09-09 23:25:34.000000000 -0300 @@ -809,8 +809,6 @@ dump_generic_node (pretty_printer *buffe == 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_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 0))) - == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)))) /* Same value types ignoring qualifiers. */ && (TYPE_MAIN_VARIANT (TREE_TYPE (node)) == TYPE_MAIN_VARIANT @@ -1173,8 +1171,6 @@ dump_generic_node (pretty_printer *buffe == 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_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (op0, 0))) - == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (op0, 1)))) /* Same value types ignoring qualifiers. */ && (TYPE_MAIN_VARIANT (TREE_TYPE (op0)) == TYPE_MAIN_VARIANT