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]

[PATCH] Fix PR c++/15721 not emitting explicit template instantation static data


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.

Thanks,
Andrew Pinski

ChangeLog:

	* toplev.c (wrapup_global_declarations): Do not check
	TREE_SYMBOL_REFERENCED of the DECL_ASSEMBLER_NAME but check
	cgraph_varpool_node's needed field.  Also do not check
	flag_unit_at_a_time to see we need to check for finalized.

Patch:
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.899
diff -u -p -r1.899 toplev.c
--- toplev.c	30 May 2004 18:32:27 -0000	1.899
+++ toplev.c	2 Jun 2004 04:57:50 -0000
@@ -1455,16 +1455,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 (node && 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 && 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]