This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/15721 not emitting explicit template instantation
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: mark at codesourcery dot com (Mark Mitchell)
- Cc: pinskia at physics dot uc dot edu (Andrew Pinski), gcc-patches at gcc dot gnu dot org (gcc-patches at gcc dot gnu dot org Patches)
- Date: Sat, 19 Jun 2004 12:16:09 -0400 (EDT)
- Subject: Re: [PATCH] Fix PR c++/15721 not emitting explicit template instantation
>
> Andrew Pinski wrote:
>
> > The problem is that the middle-end is still looking at
> > TREE_SYMBOL_REFERENCED
> > of the DECL_ASSEMBLER_NAME which is wrong now that we are moving away
> > from that.
> > This patch instead looks into the cgraph_varpool_node's needed flag to
> > see if
> > we really need the variable.
> >
> > OK? Bootstrapped on powerpc-apple-darwin with no regressions.
>
> OK.
>
And this what I checked in, I removed my to change to remove the check
for unit-at-a-time because I thought it was not safe and was not needed
to be removed.
* toplev.c (wrapup_global_declarations): Do not check
TREE_SYMBOL_REFERENCED of the DECL_ASSEMBLER_NAME but check
cgraph_varpool_node's needed field.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.905
diff -u -p -r1.905 toplev.c
--- toplev.c 14 Jun 2004 14:17:57 -0000 1.905
+++ toplev.c 19 Jun 2004 16:11:44 -0000
@@ -762,16 +762,17 @@ wrapup_global_declarations (tree *vec, i
if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
{
+ struct cgraph_varpool_node *node;
bool needed = 1;
+ node = cgraph_varpool_node (decl);
- if (flag_unit_at_a_time
- && cgraph_varpool_node (decl)->finalized)
+ if (flag_unit_at_a_time && node->finalized)
needed = 0;
else if ((flag_unit_at_a_time && !cgraph_global_info_ready)
&& (TREE_USED (decl)
|| TREE_USED (DECL_ASSEMBLER_NAME (decl))))
/* needed */;
- else if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
+ else if (node->needed)
/* needed */;
else if (DECL_COMDAT (decl))
needed = 0;