1 /* PR tree-optimization/56205 */
2 /* { dg-do compile } */
3 /* { dg-options "-O3 -fdump-tree-stdarg" } */
4
5 #include <stdarg.h>
6
7 int a, b;
8 char c[128];
9
10 static inline void
foo(int x,char const * y,va_list z)11 foo (int x, char const *y, va_list z)
12 {
13 __builtin_printf ("%s %d %s", x ? "" : "foo", ++a, (y && *y) ? "bar" : "");
14 if (y && *y)
15 __builtin_vprintf (y, z);
16 }
17
18 void
bar(int x,char const * y,...)19 bar (int x, char const *y, ...)
20 {
21 va_list z;
22 va_start (z, y);
23 if (!x && *c == '\0')
24 ++b;
25 foo (x, y, z);
26 va_end (z);
27 }
28
29 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } } } */
30 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */
31 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */
32 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */
33 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */
34 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */
35 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */
36 /* { dg-final { scan-tree-dump "bar: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */
37