Commit 5ee770bf by Jan Hubicka Committed by Jan Hubicka

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
parent e5b8c090
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)
......
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
......
/* { 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 ();
}
/* { 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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment