public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/51998] New: compiler hangs on self-recursive alias attribute Date: Wed, 25 Jan 2012 14:39:00 -0000 [thread overview] Message-ID: <bug-51998-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51998 Bug #: 51998 Summary: compiler hangs on self-recursive alias attribute Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: vries@gcc.gnu.org inline-2.c: ... static void f (void) __attribute__((alias("f"))); void g () { f (); } ... hangs (with compiler build with r183325): ... $ gcc inline-2.c -O2 -S ... a mutually recursive version has the same problem: ... static void f (void) __attribute__((alias("g"))); static void g (void) __attribute__((alias("f"))); void h () { f (); } ... The compiler is stuck in this loop in cgraph_function_or_thunk_node: ... 1042 while (node) (gdb) 1044 if (node->alias && node->analyzed) (gdb) 1045 node = cgraph_alias_aliased_node (node); (gdb) 1042 while (node) ... The following tentative patch allows the compiler to abort compilation: ... Index: cgraph.h =================================================================== --- cgraph.h (revision 183325) +++ cgraph.h (working copy) @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. #include "tree.h" #include "basic-block.h" #include "function.h" +#include "diagnostic-core.h" #include "ipa-ref.h" /* FIXME: inappropriate dependency of cgraph on IPA. */ enum availability @@ -1037,12 +1038,17 @@ cgraph_function_node (struct cgraph_node static inline struct cgraph_node * cgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *availability) { + struct cgraph_node *start = node; if (availability) *availability = cgraph_function_body_availability (node); while (node) { if (node->alias && node->analyzed) - node = cgraph_alias_aliased_node (node); + { + node = cgraph_alias_aliased_node (node); + if (start == node) + fatal_error ("function %q+D part of alias cycle", start->decl); + } else return node; if (node && availability) ... with an error message: ... $ gcc inline-2.c inline-3.c -O2 -S inline-2.c:1:13: fatal error: function ‘f’ part of alias cycle compilation terminated. inline-3.c:1:13: fatal error: function ‘f’ part of alias cycle compilation terminated. ...
next reply other threads:[~2012-01-25 14:11 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-01-25 14:39 vries at gcc dot gnu.org [this message] 2012-01-25 14:41 ` [Bug middle-end/51998] " rguenth at gcc dot gnu.org 2012-01-25 15:03 ` jakub at gcc dot gnu.org 2012-01-25 17:17 ` vries at gcc dot gnu.org 2012-01-25 17:32 ` jakub at gcc dot gnu.org 2012-01-26 15:14 ` hubicka at ucw dot cz 2012-01-31 14:21 ` hubicka at gcc dot gnu.org 2012-01-31 15:28 ` jakub at gcc dot gnu.org 2012-02-02 13:30 ` hubicka at gcc dot gnu.org 2012-02-02 13:32 ` hubicka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-51998-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).