This patch fixed a bug in lipo varpool node linking.

C++ FE drops the initializer if it's not used in this TU. For current
varpool linking may
resolve the varpool node to the one with null initializer.

-Rong


Index: l-ipo.c
===================================================================
--- l-ipo.c     (revision 201800)
+++ l-ipo.c     (working copy)
@@ -2151,6 +2151,19 @@ resolve_varpool_node (struct varpool_node **slot,
       return;
     }

+  if (DECL_INITIAL (decl1) && !DECL_INITIAL (decl2))
+    {
+      merge_addressable_attr (decl1, decl2);
+      return;
+    }
+
+  if (!DECL_INITIAL (decl1) && DECL_INITIAL (decl2))
+    {
+      *slot = node;
+      merge_addressable_attr (decl2, decl1);
+      return;
+    }
+
   /* Either all complete or neither's type is complete. Just
      pick the primary module's decl.  */
   if (!varpool_is_auxiliary (*slot))

Reply via email to