re PR ipa/61548 (FAIL: gcc.dg/tls/alias-1.c)
authorJan Hubicka <hubicka@ucw.cz>
Thu, 5 Feb 2015 04:01:25 +0000 (05:01 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 5 Feb 2015 04:01:25 +0000 (04:01 +0000)
PR ipa/61548
* ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue
when removing varpool nodes.

From-SVN: r220433

gcc/ChangeLog
gcc/ipa.c

index 6c19064957de42ded707e4f3e86312ad5eb48e48..29049bd574119242b4b06002993ffb1a9d71bf81 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-04  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/61548
+       * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue
+       when removing varpool nodes.
+
 2015-02-04  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/61548
index 36264175f57509cddfcb9c5a8ec0c6041da48f12..9cbd2da8023678689f914d32f4a43156f5b460b3 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -597,8 +597,20 @@ symbol_table::remove_unreachable_nodes (FILE *file)
             or not.  */
          && (!flag_ltrans || !DECL_EXTERNAL (vnode->decl)))
        {
+         struct ipa_ref *ref = NULL;
+
+         /* First remove the aliases, so varpool::remove can possibly lookup
+            the constructor and save it for future use.  */
+         while (vnode->iterate_direct_aliases (0, ref))
+           {
+             if (file)
+               fprintf (file, " %s/%i", ref->referred->name (),
+                        ref->referred->order);
+             ref->referring->remove ();
+           }
          if (file)
            fprintf (file, " %s/%i", vnode->name (), vnode->order);
+          vnext = next_variable (vnode);
          vnode->remove ();
          changed = true;
        }