OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / pr44942.c
1 /* PR target/44942 */
2
3 #include <stdarg.h>
4
5 void
6 test1 (int a, int b, int c, int d, int e, int f, int g, long double h, ...)
7 {
8   int i;
9   va_list ap;
10
11   va_start (ap, h);
12   i = va_arg (ap, int);
13   if (i != 1234)
14     __builtin_abort ();
15   va_end (ap);
16 }
17
18 void
19 test2 (int a, int b, int c, int d, int e, int f, int g, long double h, int i,
20        long double j, int k, long double l, int m, long double n, ...)
21 {
22   int o;
23   va_list ap;
24
25   va_start (ap, n);
26   o = va_arg (ap, int);
27   if (o != 1234)
28     __builtin_abort ();
29   va_end (ap);
30 }
31
32 void
33 test3 (double a, double b, double c, double d, double e, double f,
34        double g, long double h, ...)
35 {
36   double i;
37   va_list ap;
38
39   va_start (ap, h);
40   i = va_arg (ap, double);
41   if (i != 1234.0)
42     __builtin_abort ();
43   va_end (ap);
44 }
45
46 void
47 test4 (double a, double b, double c, double d, double e, double f, double g,
48        long double h, double i, long double j, double k, long double l,
49        double m, long double n, ...)
50 {
51   double o;
52   va_list ap;
53
54   va_start (ap, n);
55   o = va_arg (ap, double);
56   if (o != 1234.0)
57     __builtin_abort ();
58   va_end (ap);
59 }
60
61 int
62 main ()
63 {
64   test1 (0, 0, 0, 0, 0, 0, 0, 0.0L, 1234);
65   test2 (0, 0, 0, 0, 0, 0, 0, 0.0L, 0, 0.0L, 0, 0.0L, 0, 0.0L, 1234);
66   test3 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 1234.0);
67   test4 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0L, 0.0, 0.0L,
68          0.0, 0.0L, 0.0, 0.0L, 1234.0);
69   return 0;
70 }