comparison gcc/testsuite/c-c++-common/dfp/struct-layout-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 #include <stdarg.h>
2 #include "dfp-dbg.h"
3
4 struct S1
5 {
6 _Decimal64 a[0];
7 };
8
9 struct S2
10 {
11 struct
12 {
13 _Decimal64 e;
14 } b[0];
15 };
16
17 struct S3
18 {
19 union
20 {
21 _Decimal64 c;
22 } a[0];
23 };
24
25 struct S4
26 {
27 int a[0];
28 _Decimal64 b[0];
29 };
30
31 struct S5
32 {
33 union
34 {
35 _Decimal64 c[0];
36 } a;
37 };
38
39 int check_var (int z, ...)
40 {
41 long long result;
42 va_list ap;
43 va_start (ap, z);
44 va_arg (ap, struct S1);
45 result = va_arg (ap, long long);
46 va_end (ap);
47
48 return (result == 2LL);
49 }
50
51 int main ()
52 {
53 struct S1 s1;
54 struct S2 s2;
55 struct S3 s3;
56 struct S4 s4;
57 struct S5 s5;
58
59 if (check_var (2, s1, 2LL) == 0)
60 FAILURE;
61 if (check_var (2, s2, 2LL) == 0)
62 FAILURE;
63 if (check_var (2, s3, 2LL) == 0)
64 FAILURE;
65 if (check_var (2, s4, 2LL) == 0)
66 FAILURE;
67 if (check_var (2, s5, 2LL) == 0)
68 FAILURE;
69
70 FINISH
71 }