From e6e26e59a357e5e6d5a6d19e2c8142bbe8af86cd Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Tue, 26 Apr 2011 13:00:53 +0000 Subject: [PATCH] re PR c/48731 (regression: __attribute__((flatten)) produces error with function calling variadic functions) 2011-04-26 Richard Guenther PR tree-optimization/48731 * gcc.dg/torture/pr48731.c: New testcase. From-SVN: r172964 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr48731.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr48731.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b44671a651..03af544fef4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-26 Richard Guenther + + PR tree-optimization/48731 + * gcc.dg/torture/pr48731.c: New testcase. + 2011-04-26 Richard Guenther PR testsuite/48753 diff --git a/gcc/testsuite/gcc.dg/torture/pr48731.c b/gcc/testsuite/gcc.dg/torture/pr48731.c new file mode 100644 index 00000000000..74b77f67c52 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr48731.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +#include + +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); +} -- 2.30.2