cgraph: Avoid creating multiple *.localalias aliases with the same name [PR93384]
authorJakub Jelinek <jakub@redhat.com>
Thu, 30 Jan 2020 20:32:36 +0000 (21:32 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 30 Jan 2020 20:32:36 +0000 (21:32 +0100)
commit5fb07870fa4c86f529930bae76689ed5bdfcb192
tree83144eb52431ff0034942c9e7d869f5db3a5070d
parent56b92750f83724177d2c6eae30c208e935a56a37
cgraph: Avoid creating multiple *.localalias aliases with the same name [PR93384]

The following testcase FAILs on powerpc64le-linux with assembler errors, as we
emit a call to bar.localalias, then .set bar.localalias, bar twice and then
another call to bar.localalias.  The problem is that bar.localalias can be created
at various stages and e.g. ipa-pure-const can slightly adjust the original decl,
so that the existing bar.localalias isn't considered usable (different
flags_from_decl_or_type).  In that case, we'd create another bar.localalias, which
clashes with the existing name.

Fixed by retrying with another name if it is already present.  The various localalias
aliases shouldn't be that many, from different partitions they would be lto_priv
suffixed and in most cases they would already have the same type/flags/attributes.

2020-01-30  Jakub Jelinek  <jakub@redhat.com>

PR lto/93384
* symtab.c (symtab_node::noninterposable_alias): If localalias
already exists, but is not usable, append numbers after it until
a unique name is found.  Formatting fix.

* gcc.dg/lto/pr93384_0.c: New test.
* gcc.dg/lto/pr93384_1.c: New file.
gcc/ChangeLog
gcc/symtab.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr93384_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr93384_1.c [new file with mode: 0644]