Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.dg / dfp / struct-layout-1.c
blob9e54e48c72646523990dbb2897622df88d0b84b4
1 /* { dg-options "-std=gnu99" } */
3 #include <stdarg.h>
5 extern void abort (void);
7 struct S1
9 _Decimal64 a[0];
12 struct S2
14 struct
16 _Decimal64 e;
17 } b[0];
20 struct S3
22 union
24 _Decimal64 c;
25 } a[0];
28 struct S4
30 int a[0];
31 _Decimal64 b[0];
34 struct S5
36 union
38 _Decimal64 c[0];
39 } a;
42 static int failcnt = 0;
44 /* Support compiling the test to report individual failures; default is
45 to abort as soon as a check fails. */
46 #ifdef DBG
47 #include <stdio.h>
48 #define FAILURE do \
49 { printf ("failed at line %d\n", __LINE__); \
50 failcnt++; \
51 }while(0)
52 #else
53 #define FAILURE abort ()
54 #endif
56 int check_var (int z, ...)
58 long long result;
59 va_list ap;
60 va_start (ap, z);
61 va_arg (ap, struct S1);
62 result = va_arg (ap, long long);
63 va_end (ap);
65 return (result == 2LL);
68 int main ()
70 struct S1 s1;
71 struct S2 s2;
72 struct S3 s3;
73 struct S4 s4;
74 struct S5 s5;
76 if (check_var (2, s1, 2LL) == 0)
77 FAILURE;
78 if (check_var (2, s2, 2LL) == 0)
79 FAILURE;
80 if (check_var (2, s3, 2LL) == 0)
81 FAILURE;
82 if (check_var (2, s4, 2LL) == 0)
83 FAILURE;
84 if (check_var (2, s5, 2LL) == 0)
85 FAILURE;
87 if (failcnt)
88 abort ();
90 return 0;