https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61548
--- Comment #14 from tbsaunde+mozilla at tbsaunde dot org --- On Mon, Jan 26, 2015 at 03:56:05AM +0000, hubicka at ucw dot cz wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61548 > > --- Comment #13 from Jan Hubicka <hubicka at ucw dot cz> --- > > So, what is here is: > > emutls calls varpool_node::create_alias(decl("emutls_v.bar"), > > decl("emutls_v.foo")) which sets alias = true and alias_target = > > node("emutls_v.foo") on the node for "emutls_v.bar", however it does not > > set up > > ref_list.references on node("emutls_v.bar") to point at > > node("emutls_v.foo"). > > Then during varification we call symtab_node::get_alias_target() which gets > > the > > alias from node("emutls_v.bar").ref_list.references but that crashes > > becauses > > references doesn't contain an element for the alias target. > > The way to get the references for alias is to call alias->resolve_alias. > The resolution normally happens at the end of parsing but if someone > introduces > new alias late, he needs to cal the resolve_alias manually. With that fixed things get a little farther, but there's still a problem. symbol_table::remove_unreachable_node () decides to remove one of the tls aliases. When varpool_node::remove () is called it first clears ref_list with a call to symtab_node::unregister () and then calls varpool_node::cdtor_usable_for_folding () which tries to get the alias target, and so crashes because ref_list has been cleared. I guess the simplest thing is to call cdtor_usable_for_folding earlier, but I don't know if there's something better. Trev