[RFA] Emit DWARF for template parameters (PR debug/30161)

Jason Merrill jason@redhat.com
Fri Aug 21 21:15:00 GMT 2009


On 08/21/2009 12:00 PM, Dodji Seketeli wrote:
> else if (DECL_P (*tp)&&  TREE_CODE (*tp) == FUNCTION_DECL
>             &&  (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
>      {
>        struct cgraph_node *node = cgraph_node (*tp);
>        if (node->process || TREE_ASM_WRITTEN (*tp))
>          return *tp;
>      }
>
> To be honest, I don't understand what this test does. I mean, either we
> have cgraph data and we should rely on node->needed, or we don't and we can
> speculate. And as far as the speculation goes, I don't understand why if
> TREE_ASM_WRITTEN is set (if we don't have cgraph data), we can consider
> that the function is unused.
>
> Why does this test mean ?

I agree, that doesn't make sense to me either.  I think this is a thinko 
in Jan's Mar 28 patch (09fc9532d) and the test should really be

if (!node->process && !TREE_ASM_WRITTEN (*tp))
   return *tp;

> else if (DECL_P (*tp)&&  TREE_CODE (*tp) == VAR_DECL)
>      {
>        struct varpool_node *node = varpool_node (*tp);
>        if (!node->needed)
>          return *tp;
>      }
>    else if (DECL_P (*tp)&&  TREE_CODE (*tp) == FUNCTION_DECL
>             &&  (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
>      {
>        struct cgraph_node *node = cgraph_node (*tp);
>        if (node->process || TREE_ASM_WRITTEN (*tp))
>          return *tp;
>      }
>
> These two if branches access cgraph data without testing that
> cgraph_global_info_ready is true.

No, they don't.  That was tested in a previous else:

>   else if (!cgraph_global_info_ready
>            && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
>     return *tp;

The DECL_Ps in the above two elses are redundant, though.

Jason



More information about the Gcc-patches mailing list