This adds a missing check for ->local.inlinable to cgraph_flatten.
Honza fixed this on trunk by factoring out the checks.

Bootstrapped and tested on x86_64-unknown-linux-gnu, installed.

Richard.

2011-04-26  Richard Guenther  <rguent...@suse.de>

        PR tree-optimization/48731
        * ipa-inline.c (cgraph_flatten): Test if function is inlinable.

        * gcc.dg/torture/pr48731.c: New testcase.

Index: gcc/ipa-inline.c
===================================================================
*** gcc/ipa-inline.c    (revision 172962)
--- gcc/ipa-inline.c    (working copy)
*************** cgraph_flatten (struct cgraph_node *node
*** 1337,1342 ****
--- 1337,1345 ----
          continue;
        }
  
+       if (!e->callee->local.inlinable)
+       continue;
+ 
        /* We've hit cycle?  It is time to give up.  */
        if (e->callee->aux)
        {
Index: gcc/testsuite/gcc.dg/torture/pr48731.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr48731.c      (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr48731.c      (revision 0)
***************
*** 0 ****
--- 1,24 ----
+ /* { dg-do compile } */
+ 
+ #include <stdarg.h>
+ 
+ int blah(int a, ...)
+ {
+   va_list va;
+   va_start(va,a);
+   if (a == 0)
+     return -1;
+   else 
+     {
+       int i;
+       for (i = 0; i < a; i++)
+       va_arg(va,int);
+       return va_arg(va,int);
+     }
+ }
+ 
+ __attribute((flatten))
+ int blah2(int b, int c)
+ {
+   return blah(2, b, c);
+ }

Reply via email to