From d2b35c0464fc5b071f8bbf77079bce6a9170f15c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Feb 2015 05:01:25 +0100 Subject: [PATCH] re PR ipa/61548 (FAIL: gcc.dg/tls/alias-1.c) PR ipa/61548 * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue when removing varpool nodes. From-SVN: r220433 --- gcc/ChangeLog | 6 ++++++ gcc/ipa.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c19064957d..29049bd5741 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-04 Jan Hubicka + + PR ipa/61548 + * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue + when removing varpool nodes. + 2015-02-04 Jan Hubicka PR ipa/61548 diff --git a/gcc/ipa.c b/gcc/ipa.c index 36264175f57..9cbd2da8023 100644 --- 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; } -- 2.30.2