OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 931004-14.c
1 #include <stdarg.h>
2
3 struct tiny
4 {
5   char c;
6   char d;
7   char e;
8   char f;
9 };
10
11 f (int n, ...)
12 {
13   struct tiny x;
14   int i;
15
16   va_list ap;
17   va_start (ap,n);
18   for (i = 0; i < n; i++)
19     {
20       x = va_arg (ap,struct tiny);
21       if (x.c != i + 10)
22         abort();
23       if (x.d != i + 20)
24         abort();
25       if (x.e != i + 30)
26         abort();
27       if (x.f != i + 40)
28         abort();
29     }
30   {
31     long x = va_arg (ap, long);
32     if (x != 123)
33       abort();
34   }
35   va_end (ap);
36 }
37
38 main ()
39 {
40   struct tiny x[3];
41   x[0].c = 10;
42   x[1].c = 11;
43   x[2].c = 12;
44   x[0].d = 20;
45   x[1].d = 21;
46   x[2].d = 22;
47   x[0].e = 30;
48   x[1].e = 31;
49   x[2].e = 32;
50   x[0].f = 40;
51   x[1].f = 41;
52   x[2].f = 42;
53   f (3, x[0], x[1], x[2], (long) 123);
54   exit(0);
55 }
56