aboutsummaryrefslogtreecommitdiff
path: root/gcc/varpool.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-02-02 14:29:31 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2012-02-02 13:29:31 +0000
commit5ee770bf9e6941a2d1f8d59e9e663fa08c818b42 (patch)
tree612c65dfb166b3f5da06ecbb2601952b92d2abb1 /gcc/varpool.c
parente5b8c090111e81d8297514ea7bc283bd4472ef75 (diff)
downloadgcc-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/varpool.c')
-rw-r--r--gcc/varpool.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c
index e01accb..c2d88c3 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. */