[debug-early] Allow checking of DECL_ABSTRACT in decl_ultimate_origin

Aldy Hernandez aldyh@redhat.com
Fri Sep 19 15:32:00 GMT 2014


Michael, I really don't understand the need for this change in your 
original patch.  I don't know if this was a temporary testing change or 
what.

For instance, you had the following commented out in your original patch:

   if (/*DECL_ABSTRACT (decl) &&*/ DECL_ABSTRACT_ORIGIN (decl) == decl)
      return NULL_TREE;

but then you also had:

  tree origin = decl_ultimate_origin (decl);
<snip>
<snip>
-  if (origin != NULL)
+  if (origin != NULL && origin != decl)

It seems to me that if origin is not null, then "origin != decl" will 
always be true, since with your change, decl_ultimate_origin() will 
always return NULL when DECL_ABSTRACT_ORIGIN (decl) == decl.

I suppose your /*DECL_ABSTRACT (decl) &&*/ change could be used in other 
uses of decl_ultimate_origin() that don't have this "&& origin != decl" 
business.

Anyway... I don't understand the need for it (actually, to be honest, I 
don't understand what you were trying to do).  I'm going to remove it.

If you feel strongly about it, please chime in, and perhaps provide an 
explanation so I can include a comment.

I'm happy to report that with this and the last set of patches, both C 
and C++ guality tests have <= regressions than mainline.  Yay.

Committing to mainline.

Thanks.
Aldy
-------------- next part --------------
commit 7254ec0893f9b56a0ba78de9eab8895c9582c24b
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Sep 18 16:54:39 2014 -0600

    	* dwarf2out.c (decl_ultimate_origin): Allow checking of
    	DECL_ABSTRACT.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f6c7f4a..68b4650 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3683,7 +3683,7 @@ decl_ultimate_origin (const_tree decl)
   /* output_inline_function sets DECL_ABSTRACT_ORIGIN for all the
      nodes in the function to point to themselves; ignore that if
      we're trying to output the abstract instance of this function.  */
-  if (/*DECL_ABSTRACT (decl) &&*/ DECL_ABSTRACT_ORIGIN (decl) == decl)
+  if (DECL_ABSTRACT (decl) && DECL_ABSTRACT_ORIGIN (decl) == decl)
     return NULL_TREE;
 
   /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the


More information about the Gcc-patches mailing list