Hi, this patch fixes the infinite recursion triggered when buildling MIPS libgcc. Bootstrapping/regtesting x86_64-linux and will commit it once it passes. Thanks to Richard for reducing the testcase.
Honza PR middle-end/49735 * gcc.c-torture/compile/pr49735.c: New testcase * ipa-inline.c (recursive_inlining): Look through aliases. Index: gcc/testsuite/gcc.c-torture/compile/pr49735.c =================================================================== --- gcc/testsuite/gcc.c-torture/compile/pr49735.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr49735.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-require-alias "" } */ +void bar (void); +static void foo (void) { bar (); } +void bar (void) __attribute__((alias("foo"))); Index: gcc/ipa-inline.c =================================================================== --- gcc/ipa-inline.c (revision 177411) +++ gcc/ipa-inline.c (working copy) @@ -1206,8 +1206,9 @@ recursive_inlining (struct cgraph_edge * depth = 1; for (cnode = curr->caller; cnode->global.inlined_to; cnode = cnode->callers->caller) - if (node->decl == curr->callee->decl) - depth++; + if (node->decl + == cgraph_function_or_thunk_node (curr->callee, NULL)->decl) + depth++; if (!want_inline_self_recursive_call_p (curr, node, false, depth)) continue;