OSDN Git Service

2011-04-26 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Apr 2011 12:59:22 +0000 (12:59 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Apr 2011 12:59:22 +0000 (12:59 +0000)
PR tree-optimization/48731
* ipa-inline.c (cgraph_flatten): Test if function is inlinable.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172963 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr48731.c [new file with mode: 0644]

index b08e263..d48952a 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/48731
+       * ipa-inline.c (cgraph_flatten): Test if function is inlinable.
+
 2011-04-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR other/48748
index b3c9215..cbda4be 100644 (file)
@@ -1337,6 +1337,9 @@ cgraph_flatten (struct cgraph_node *node)
          continue;
        }
 
+      if (!e->callee->local.inlinable)
+       continue;
+
       /* We've hit cycle?  It is time to give up.  */
       if (e->callee->aux)
        {
index 8b4a2f4..581f168 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/48731
+       * gcc.dg/torture/pr48731.c: New testcase.
+
 2011-04-26  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/48588
diff --git a/gcc/testsuite/gcc.dg/torture/pr48731.c b/gcc/testsuite/gcc.dg/torture/pr48731.c
new file mode 100644 (file)
index 0000000..74b77f6
--- /dev/null
@@ -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);
+}