Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/va-arg-4.c

raw
1 /* On the i960 any arg bigger than 16 bytes causes all subsequent args
2 to be passed on the stack. We test this. */
3
4 #include <stdarg.h>
5
6 void abort (void);
7 void exit (int);
8
9 typedef struct {
10 char a[32];
11 } big;
12
13 void
14 f (big x, char *s, ...)
15 {
16 va_list ap;
17
18 if (x.a[0] != 'a' || x.a[1] != 'b' || x.a[2] != 'c')
19 abort ();
20 va_start (ap, s);
21 if (va_arg (ap, int) != 42)
22 abort ();
23 if (va_arg (ap, int) != 'x')
24 abort ();
25 if (va_arg (ap, int) != 0)
26 abort ();
27 va_end (ap);
28 }
29
30 int
31 main (void)
32 {
33 static big x = { "abc" };
34
35 f (x, "", 42, 'x', 0);
36 exit (0);
37 }