re PR lto/69866 (lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:158)

PR lto/69866
	* lto-symtab.c (lto_symtab_merge_symbols): Drop useless definitions
	that resolved externally.

	* gcc.dg/lto/pr69866_0.c: New test.
	* gcc.dg/lto/pr69866_1.c: Likewise.

From-SVN: r249224
This commit is contained in:
Jan Hubicka 2017-06-15 18:42:10 +00:00
parent 55dabf65f0
commit d1eed638ed
6 changed files with 69 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2017-06-15 Jan Hubicka <hubicka@ucw.cz>
Thomas Preud'homme <thomas.preudhomme@arm.com>
PR lto/69866
* lto-symtab.c (lto_symtab_merge_symbols): Drop useless definitions
that resolved externally.
2017-05-23 Jan Hubicka <hubicka@ucw.cz>
* lto.c (do_whole_program_analysis): Replace inline_free_summary

View File

@ -132,7 +132,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
/* Be sure that we never try to duplicate partitioned symbol
or add external symbol. */
gcc_assert (c != SYMBOL_EXTERNAL
gcc_assert ((c != SYMBOL_EXTERNAL || node->alias)
&& (c == SYMBOL_DUPLICATE || !symbol_partitioned_p (node)));
part->symbols++;

View File

@ -952,6 +952,42 @@ lto_symtab_merge_symbols (void)
if (tgt)
node->resolve_alias (tgt, true);
}
/* If the symbol was preempted outside IR, see if we want to get rid
of the definition. */
if (node->analyzed
&& !DECL_EXTERNAL (node->decl)
&& (node->resolution == LDPR_PREEMPTED_REG
|| node->resolution == LDPR_RESOLVED_IR
|| node->resolution == LDPR_RESOLVED_EXEC
|| node->resolution == LDPR_RESOLVED_DYN))
{
DECL_EXTERNAL (node->decl) = 1;
/* If alias to local symbol was preempted by external definition,
we know it is not pointing to the local symbol. Remove it. */
if (node->alias
&& !node->weakref
&& !node->transparent_alias
&& node->get_alias_target ()->binds_to_current_def_p ())
{
node->alias = false;
node->remove_all_references ();
node->definition = false;
node->analyzed = false;
node->cpp_implicit_alias = false;
}
else if (!node->alias
&& node->definition
&& node->get_availability () <= AVAIL_INTERPOSABLE)
{
if ((cnode = dyn_cast <cgraph_node *> (node)) != NULL)
cnode->reset ();
else
{
node->analyzed = node->definition = false;
node->remove_all_references ();
}
}
}
if (!(cnode = dyn_cast <cgraph_node *> (node))
|| !cnode->clone_of

View File

@ -1,3 +1,9 @@
2017-06-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR lto/69866
* gcc.dg/lto/pr69866_0.c: New test.
* gcc.dg/lto/pr69866_1.c: Likewise.
2017-06-15 Jozef Lawrynowicz <jozef.l@somniumtech.com>
PR target/78818

View File

@ -0,0 +1,13 @@
/* { dg-lto-do link } */
int _umh(int i)
{
return i+1;
}
int weaks(int i) __attribute__((weak, alias("_umh")));
int main()
{
return weaks(10);
}

View File

@ -0,0 +1,6 @@
/* { dg-options { -fno-lto } } */
int weaks(int i)
{
return i+1;
}