aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr52691.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr52691.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr52691.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr52691.c b/gcc/testsuite/gcc.dg/pr52691.c
new file mode 100644
index 0000000..7a2d7d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52691.c
@@ -0,0 +1,24 @@
+/* PR middle-end/52691 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+#include <stdarg.h>
+
+int
+foo (int a, ...)
+{
+ int b = 0, c = 0;
+ va_list ap;
+ va_start (ap, a);
+ if (a > 1)
+ b = va_arg (ap, double);
+ if (a > 2)
+ c = va_arg (ap, long long);
+ va_end (ap);
+ return a + b + c;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */
+/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-darwin* powerpc*-*-aix* } } } } */
+/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-linux* && lp64 } } } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */