Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-va-arg-4.c
blob45a28191017b88998be616ac71d707557e185d69
1 /*
2 va-arg-4.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 /* On the i960 any arg bigger than 16 bytes causes all subsequent args
8 to be passed on the stack. We test this. */
10 #include <stdarg.h>
12 typedef struct {
13 char a[32];
14 } big;
16 void
17 f (big x, char *s, ...)
19 va_list ap;
21 if (x.a[0] != 'a' || x.a[1] != 'b' || x.a[2] != 'c')
22 ASSERT (0);
23 va_start (ap, s);
24 if (va_arg (ap, int) != 42)
25 ASSERT (0);
26 if (va_arg (ap, int) != 'x')
27 ASSERT (0);
28 if (va_arg (ap, int) != 0)
29 ASSERT (0);
30 va_end (ap);
33 void
34 testTortureExecute (void)
36 static big x = { "abc" };
38 f (x, "", 42, 'x', 0);
39 return;