This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/51998] compiler hangs on self-recursive alias attribute


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51998

--- Comment #3 from vries at gcc dot gnu.org 2012-01-25 16:33:12 UTC ---
(In reply to comment #2)
> I think fatal_error is undesirable, you should error on it somewhere and just
> drop the alias attribute.

Jakub, 

like this? :
...
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,21 @@ 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)
+        {
+          node->alias = false;
+          error ("function %q+D part of alias cycle", start->decl);
+          return node;
+        }
+    }
       else
     return node;
       if (node && availability)
...

now normal rather than fatal errors:
...
$ gcc inline-2.c inline-3.c -O2 -S
inline-2.c:1:13: error: function âfâ part of alias cycle
inline-3.c:1:13: error: function âfâ part of alias cycle
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]