Patchwork [PR,debug/45130] fix MEM_REF -fcompare-debug regression

login
register
mail settings
Submitter Alexandre Oliva
Date Sept. 10, 2010, 11:01 p.m.
Message ID <ory6b9gq41.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/64476/
State New
Headers show

Comments

Alexandre Oliva - Sept. 10, 2010, 11:01 p.m.
On Sep  8, 2010, "H.J. Lu" <hjl.tools@gmail.com> 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.
Richard Guenther - Sept. 11, 2010, 10:14 a.m.
On Sat, Sep 11, 2010 at 1:01 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Sep  8, 2010, "H.J. Lu" <hjl.tools@gmail.com> 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.

Yes, this makes sense.

Thanks,
Richard.

>
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist      Red Hat Brazil Compiler Engineer
>
>

Patch

for gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	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