struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-va-arg-14.c
blob4fa25310f9b7be28e6f656e0ed2586bc8b7f91e0
1 /*
2 va-arg-14.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #include <stdarg.h>
9 #pragma disable_warning 84 // suppress 'auto' variable may be used before initialization
11 va_list global;
13 void vat(va_list param, ...)
15 va_list local;
17 va_start (local, param);
18 va_copy (global, local);
19 va_copy (param, local);
20 ASSERT (va_arg (local, int) == 1);
21 va_end (local);
22 ASSERT (va_arg (global, int) == 1);
23 va_end (global);
24 ASSERT (va_arg (param, int) == 1);
25 va_end (param);
27 va_start (param, param);
28 va_start (global, param);
29 va_copy (local, param);
30 ASSERT (va_arg (local, int) == 1);
31 va_end (local);
32 va_copy (local, global);
33 ASSERT (va_arg (local, int) == 1);
34 va_end (local);
35 ASSERT (va_arg (global, int) == 1);
36 va_end (global);
37 ASSERT (va_arg (param, int) == 1);
38 va_end (param);
41 void
42 testTortureExecute (void)
44 va_list t; /* since the va_list type is undefined in C, 't' cannot be initialized */
45 vat (t, 1);
46 return;