This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]