* 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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183836
138bc75d-0d04-0410-961f-
82ee72b054a4
+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>
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
--- /dev/null
+/* { 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 ();
+}
--- /dev/null
+/* { 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 ();
+}
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. */