1 // __builtin_va_arg_pack () builtin tests.
3 // { dg-options "-O2" }
7 extern "C" void abort (void);
11 void *v3 = (void *) &v2;
12 struct A { char c[16]; } v4 = { "foo" };
17 __attribute__ ((noinline)) int
18 foo1 (int x, int y, ...)
28 if (x < 0 || x >= 20 || seen[x])
40 if (i != 9 || v1 != 9)
42 a = va_arg (ap, struct A);
43 if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0)
45 v = (void *) va_arg (ap, struct A *);
46 if (v != (void *) &v4)
48 l = va_arg (ap, long int);
49 if (l != 3 || v2 != 4)
53 ld = va_arg (ap, long double);
54 if (ld != 41 || v5 != ld)
59 v = va_arg (ap, void *);
72 __attribute__ ((noinline)) int
73 foo2 (int x, int y, ...)
82 if (x < 0 || x >= 20 || seen[x])
92 ld = va_arg (ap, long double);
93 if (ld != 41 || v5 != 40)
95 a = va_arg (ap, struct A);
96 if (__builtin_memcmp (a.c, v4.c, sizeof (a.c)) != 0)
98 b = va_arg (ap, struct A);
99 if (__builtin_memcmp (b.c, v4.c, sizeof (b.c)) != 0)
101 v = va_arg (ap, void *);
104 ll = va_arg (ap, long long int);
117 __attribute__ ((noinline)) int
123 extern inline __attribute__ ((always_inline, gnu_inline)) int
127 return foo1 (x, foo3 (), 5, __builtin_va_arg_pack ());
128 return foo2 (x, foo3 () + 4, __builtin_va_arg_pack ());
134 if (bar (0, ++v1, v4, &v4, v2++) != 0)
136 if (bar (1, ++v5, 8, v3) != 1)
140 if (bar (v1 + 2) != 19)
142 if (bar (v1 + 3, v5--, v4, v4, v3, 16LL) != 20)