OSDN Git Service

2012-12-15 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / tree-streamer-out.c
index fea15ff..d90ee80 100644 (file)
@@ -405,7 +405,13 @@ streamer_write_chain (struct output_block *ob, tree t, bool ref_p)
       saved_chain = TREE_CHAIN (t);
       TREE_CHAIN (t) = NULL_TREE;
 
-      stream_write_tree (ob, t, ref_p);
+      /* We avoid outputting external vars or functions by reference
+        to the global decls section as we do not want to have them
+        enter decl merging.  This is, of course, only for the call
+        for streaming BLOCK_VARS, but other callers are safe.  */
+      stream_write_tree (ob, t,
+                        ref_p && !(VAR_OR_FUNCTION_DECL_P (t)
+                                   && DECL_EXTERNAL (t)));
 
       TREE_CHAIN (t) = saved_chain;
       t = TREE_CHAIN (t);