aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-02-02 13:29:31 +0000
committerJan Hubicka <jh@suse.cz>2012-02-02 13:29:31 +0000
commit0b0b103bb2c94896f7028da57fcdd2b4c77b960c (patch)
tree612c65dfb166b3f5da06ecbb2601952b92d2abb1 /gcc/cgraphunit.c
parent2b04b13ca9ac58f33aae400ea815eb0fb799fed7 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@183836 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 8f96d3859bf..ddc026163ce 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)