diff options
author | Jan Hubicka <jh@suse.cz> | 2012-02-02 13:29:31 +0000 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2012-02-02 13:29:31 +0000 |
commit | 0b0b103bb2c94896f7028da57fcdd2b4c77b960c (patch) | |
tree | 612c65dfb166b3f5da06ecbb2601952b92d2abb1 /gcc/varpool.c | |
parent | 2b04b13ca9ac58f33aae400ea815eb0fb799fed7 (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/varpool.c')
-rw-r--r-- | gcc/varpool.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c index e01accb21dc..c2d88c3bd76 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -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. */ |