diff options
author | Jan Hubicka <jh@suse.cz> | 2012-02-02 14:29:31 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-02-02 13:29:31 +0000 |
commit | 5ee770bf9e6941a2d1f8d59e9e663fa08c818b42 (patch) | |
tree | 612c65dfb166b3f5da06ecbb2601952b92d2abb1 /gcc/cgraphunit.c | |
parent | e5b8c090111e81d8297514ea7bc283bd4472ef75 (diff) | |
download | gcc-5ee770bf9e6941a2d1f8d59e9e663fa08c818b42.zip gcc-5ee770bf9e6941a2d1f8d59e9e663fa08c818b42.tar.gz gcc-5ee770bf9e6941a2d1f8d59e9e663fa08c818b42.tar.bz2 |
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
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 8f96d38..ddc0261 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -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) |