struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-strct-varg-1.c
blob36dce814f7863567c3ce6d336ef75cc842b35e4a
1 /*
2 strct-varg-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #include <stdarg.h>
9 struct s { int x, y; };
11 void
12 f (int attr, ...)
14 struct s va_values;
15 va_list va;
17 va_start (va, attr);
19 ASSERT(attr == 2);
21 va_values = va_arg (va, struct s);
22 ASSERT(!(va_values.x != 0xaaaa || va_values.y != 0x5555));
24 attr = va_arg (va, int);
25 ASSERT(attr == 3);
27 va_values = va_arg (va, struct s);
28 ASSERT(!(va_values.x != 0xffff || va_values.y != 0x1111));
29 va_end (va);
32 void
33 testTortureExecute (void)
35 struct s a, b;
37 a.x = 0xaaaa;
38 a.y = 0x5555;
39 b.x = 0xffff;
40 b.y = 0x1111;
42 f (2, a, 3, b);
43 return;