]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/38237 (multiple weak directives)
authorSteve Ellcey <sje@cup.hp.com>
Mon, 30 Mar 2009 16:43:40 +0000 (16:43 +0000)
committerSteve Ellcey <sje@gcc.gnu.org>
Mon, 30 Mar 2009 16:43:40 +0000 (16:43 +0000)
PR middle-end/38237
* tree.h (tree_find_value): New declaration.
* tree.c (tree_find_value): New function.
* varasm.c (assemble_external): Avoid duplicate entries on lists.

From-SVN: r145303

gcc/ChangeLog
gcc/tree.c
gcc/tree.h
gcc/varasm.c

index 421be6ac670cfb49818ac3425a9664765c1d578b..d1de48d589d8eb1b6e5ee9a9f4f061a926b3564d 100644 (file)
@@ -1,3 +1,10 @@
+2009-03-30  Steve Ellcey  <sje@cup.hp.com>
+
+       PR middle-end/38237
+       * tree.h (tree_find_value): New declaration.
+       * tree.c (tree_find_value): New function.
+       * varasm.c (assemble_external): Avoid duplicate entries on lists.
+
 2009-03-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/39563
index 76cba2712268645bdf30d265a8ab6875e94c316d..bbc52e7fceb35532c2eaf8a36f39311fe1a8e470 100644 (file)
@@ -1802,6 +1802,18 @@ tree_last (tree chain)
   return chain;
 }
 
+/* Return the node in a chain of nodes whose value is x, NULL if not found.  */
+
+tree
+tree_find_value (tree chain, tree x)
+{
+  tree list;
+  for (list = chain; list; list = TREE_CHAIN (list))
+    if (TREE_VALUE (list) == x)
+       return list;
+  return NULL;
+}
+
 /* Reverse the order of elements in the chain T,
    and return the new head of the chain (old last element).  */
 
index 2efc9780bda0e3e3e6da084f456c68b1895a4e07..830852de8b561b0f408ddd490d782dfaa3e2b427 100644 (file)
@@ -4384,6 +4384,10 @@ extern tree tree_cons_stat (tree, tree, tree MEM_STAT_DECL);
 
 extern tree tree_last (tree);
 
+/* Return the node in a chain whose TREE_VALUE is x, NULL if not found.  */
+
+extern tree tree_find_value (tree, tree);
+
 /* Reverse the order of elements in a chain, and return the new head.  */
 
 extern tree nreverse (tree);
index e5b9f35fee9ae9916c984574e1e6a51b385bcc9d..9eefb02d8d9b013143bc4144daf630a49d33ed27 100644 (file)
@@ -2315,12 +2315,14 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
         locally emitted, inlined or otherwise not-really-extern, but
         for declarations that can be weak, it happens to be
         match.  */
-      && !TREE_STATIC (decl))
-    weak_decls = tree_cons (NULL, decl, weak_decls);
+      && !TREE_STATIC (decl)
+      && tree_find_value (weak_decls, decl) == NULL_TREE)
+      weak_decls = tree_cons (NULL, decl, weak_decls);
 
 #ifdef ASM_OUTPUT_EXTERNAL
-  pending_assemble_externals = tree_cons (0, decl,
-                                         pending_assemble_externals);
+  if (tree_find_value (pending_assemble_externals, decl) == NULL_TREE)
+    pending_assemble_externals = tree_cons (NULL, decl,
+                                           pending_assemble_externals);
 #endif
 }