OSDN Git Service

* cgraph.c (cgraph_varpool_finalize_decl): Sanity check duplicated
[pf3gnuchains/gcc-fork.git] / gcc / cgraph.c
index 4eaa60e..52a3bf6 100644 (file)
@@ -481,8 +481,14 @@ void
 cgraph_varpool_finalize_decl (tree decl)
 {
   struct cgraph_varpool_node *node = cgraph_varpool_node (decl);
-
-  if (node->needed && !node->finalized)
+  /* The first declaration of a variable that comes through this function
+     decides whether it is global (in C, has external linkage)
+     or local (in C, has internal linkage).  So do nothing more
+     if this function has already run.  */
+  if (node->finalized)
+    return;
+  if (node->needed)
     {
       node->next_needed = cgraph_varpool_nodes_queue;
       cgraph_varpool_nodes_queue = node;