re PR middle-end/51998 (compiler hangs on self-recursive alias attribute)
PR middle-end/51998 * cgraphunit.c (cgraph_analyze_function): Break cyclic aliases. * varpool.c (varpool_analyze_pending_decls): Likewise. * testsuite/gcc.dg/alias-12.c: New testcase. * testsuite/gcc.dg/alias-13.c: New testcase. Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r183836
This commit is contained in:
parent
e5b8c09011
commit
5ee770bf9e
6 changed files with 52 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2012-02-02 Jan Hubicka <jh@suse.cz>
|
||||
Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
PR middle-end/51998
|
||||
* cgraphunit.c (cgraph_analyze_function): Break cyclic aliases.
|
||||
* varpool.c (varpool_analyze_pending_decls): Likewise.
|
||||
|
||||
2012-02-02 Sumanth G <sumanth.gundapaneni@kpitcummins.com>
|
||||
Jayant R Sonar <jayant.sonar@kpitcummins.com>
|
||||
|
||||
|
|
|
@ -836,6 +836,16 @@ cgraph_analyze_function (struct cgraph_node *node)
|
|||
if (node->alias && node->thunk.alias)
|
||||
{
|
||||
struct cgraph_node *tgt = cgraph_get_node (node->thunk.alias);
|
||||
struct cgraph_node *n;
|
||||
|
||||
for (n = tgt; n && n->alias;
|
||||
n = n->analyzed ? cgraph_alias_aliased_node (n) : NULL)
|
||||
if (n == node)
|
||||
{
|
||||
error ("function %q+D part of alias cycle", node->decl);
|
||||
node->alias = false;
|
||||
return;
|
||||
}
|
||||
if (!VEC_length (ipa_ref_t, node->ref_list.references))
|
||||
ipa_record_reference (node, NULL, tgt, NULL, IPA_REF_ALIAS, NULL);
|
||||
if (node->same_body_alias)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2012-02-02 Jan Hubicka <jh@suse.cz>
|
||||
Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
PR middle-end/51998
|
||||
* testsuite/gcc.dg/alias-12.c: New testcase.
|
||||
* testsuite/gcc.dg/alias-13.c: New testcase.
|
||||
|
||||
2012-02-02 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/52086
|
||||
|
|
9
gcc/testsuite/gcc.dg/alias-12.c
Normal file
9
gcc/testsuite/gcc.dg/alias-12.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-alias "" } */
|
||||
/* { dg-options "-O2" } */
|
||||
static void f (void) __attribute__((alias("f"))); // { dg-error "part of alias cycle" "" }
|
||||
|
||||
void g ()
|
||||
{
|
||||
f ();
|
||||
}
|
9
gcc/testsuite/gcc.dg/alias-13.c
Normal file
9
gcc/testsuite/gcc.dg/alias-13.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-alias "" } */
|
||||
/* { dg-options "-O2" } */
|
||||
static void f (void) __attribute__((alias("g"))); static void g (void) __attribute__((alias("f"))); // { dg-error "part of alias cycle" "" }
|
||||
|
||||
void h ()
|
||||
{
|
||||
f ();
|
||||
}
|
|
@ -477,6 +477,16 @@ varpool_analyze_pending_decls (void)
|
|||
if (node->alias && node->alias_of)
|
||||
{
|
||||
struct varpool_node *tgt = varpool_node (node->alias_of);
|
||||
struct varpool_node *n;
|
||||
|
||||
for (n = tgt; n && n->alias;
|
||||
n = n->analyzed ? varpool_alias_aliased_node (n) : NULL)
|
||||
if (n == node)
|
||||
{
|
||||
error ("variable %q+D part of alias cycle", node->decl);
|
||||
node->alias = false;
|
||||
continue;
|
||||
}
|
||||
if (!VEC_length (ipa_ref_t, node->ref_list.references))
|
||||
ipa_record_reference (NULL, node, NULL, tgt, IPA_REF_ALIAS, NULL);
|
||||
/* C++ FE sometimes change linkage flags after producing same body aliases. */
|
||||
|
|
Loading…
Add table
Reference in a new issue