re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
authorJan Hubicka <hubicka@ucw.cz>
Tue, 8 Dec 2015 22:02:23 +0000 (23:02 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 8 Dec 2015 22:02:23 +0000 (22:02 +0000)
PR ipa/61886
* varpool.c (varpool_node::get_availability): Recurse only on
weakrefs with definition in the target.
(symbol_table::remove_unreferenced_decls): Keep aliases in the boundary.

From-SVN: r231429

gcc/ChangeLog
gcc/varpool.c

index 8554091625c017bfed8251dc244c02105c7fc823..55f89c9fd588ff0e3e66d7a6d5c5bac332ad8eeb 100644 (file)
@@ -1,8 +1,15 @@
 2015-12-08  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/61886
-       * ipa-visibility.c (can_replace_by_local_alias): Look through transparent
-       aliaes; refuse weakrefs.
+       * varpool.c (varpool_node::get_availability): Recurse only on
+       weakrefs with definition in the target.
+       (symbol_table::remove_unreferenced_decls): Keep aliases in the boundary.
+
+2015-12-08  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/61886
+       * ipa-visibility.c (can_replace_by_local_alias): Look through
+       transparent aliases; refuse weakrefs.
        (update_visibility_by_resolution_info): Skip transparent aliases in the
        analysis part
 
index ffbec6d727a40f3349471f3566832133d1d7162c..ac77269a7385e5e11c01667603ddb526907594d8 100644 (file)
@@ -490,7 +490,7 @@ varpool_node::get_availability (void)
   if (DECL_IN_CONSTANT_POOL (decl)
       || DECL_VIRTUAL_P (decl))
     return AVAIL_AVAILABLE;
-  if (transparent_alias)
+  if (transparent_alias && definition)
     {
       enum availability avail;
 
@@ -667,11 +667,11 @@ symbol_table::remove_unreferenced_decls (void)
            enqueue_node (vnode, &first);
          else
            {
-             referenced.add (node);
-             while (node->alias && node->definition)
+             referenced.add (vnode);
+             while (vnode && vnode->alias && vnode->definition)
                {
-                 node = node->get_alias_target ();
-                 referenced.add (node);
+                 vnode = vnode->get_alias_target ();
+                 referenced.add (vnode);
                }
            }
        }