1 /* { dg-do run } */
2 /* { dg-options "-std=gnu99" } */
3
4 /* This test is based on the test from ../dfp/. */
5
6 #include <stdarg.h>
7
8 extern void abort (void);
9
10 struct S1
11 {
12 long _Fract a[0];
13 };
14
15 struct S2
16 {
17 struct
18 {
19 long _Fract e;
20 } b[0];
21 };
22
23 struct S3
24 {
25 union
26 {
27 long _Fract c;
28 } a[0];
29 };
30
31 struct S4
32 {
33 int a[0];
34 long _Fract b[0];
35 };
36
37 struct S5
38 {
39 union
40 {
41 long _Fract c[0];
42 } a;
43 };
44
check_var(int z,...)45 int check_var (int z, ...)
46 {
47 long long result;
48 va_list ap;
49 va_start (ap, z);
50 va_arg (ap, struct S1);
51 result = va_arg (ap, long long);
52 va_end (ap);
53
54 return (result == 2LL);
55 }
56
main()57 int main ()
58 {
59 struct S1 s1;
60 struct S2 s2;
61 struct S3 s3;
62 struct S4 s4;
63 struct S5 s5;
64
65 if (check_var (2, s1, 2LL) == 0)
66 abort ();
67 if (check_var (2, s2, 2LL) == 0)
68 abort ();
69 if (check_var (2, s3, 2LL) == 0)
70 abort ();
71 if (check_var (2, s4, 2LL) == 0)
72 abort ();
73 if (check_var (2, s5, 2LL) == 0)
74 abort ();
75
76 return 0;
77 }
78