Debian Codegraph @

gcc/testsuite/gcc.dg/dfp/ctypes.c

raw
1 /* { dg-do compile } */
2
3 /* N1150 3: Decimal floating types.
4 C99 6.7.2: Type specifiers */
5
6 /* Test for the existence of the types. */
7 _Decimal32 sd1;
8 _Decimal64 dd2;
9 _Decimal128 td3;
10
11 #define ARRAY_SIZE 7
12
13 static _Decimal32 d32[ARRAY_SIZE];
14 static _Decimal64 d64[ARRAY_SIZE];
15 static _Decimal128 d128[ARRAY_SIZE];
16
17 extern _Decimal32 ext_d32[ARRAY_SIZE];
18 extern _Decimal64 ext_d64[ARRAY_SIZE];
19 extern _Decimal128 ext_d128[ARRAY_SIZE];
20
21 /* Test sizes for these types. */
22 int ssize[sizeof (_Decimal32) == 4 ? 1 : -1];
23 int dsize[sizeof (_Decimal64) == 8 ? 1 : -1];
24 int tsize[sizeof (_Decimal128) == 16 ? 1 : -1];
25
26 int salign = __alignof (_Decimal32);
27 int dalign = __alignof (_Decimal64);
28 int talign = __alignof (_Decimal128);
29
30 /* sizeof operator applied on an array of DFP types is n times the
31 size of a single variable of this type. */
32
33 int d32_array_size [sizeof(d32) == ARRAY_SIZE * sizeof(sd1) ? 1 : -1];
34 int d64_array_size [sizeof(d64) == ARRAY_SIZE * sizeof(dd2) ? 1 : -1];
35 int d128_array_size [sizeof(d128) == ARRAY_SIZE * sizeof(td3)? 1 : -1];
36
37 /* Likewise for extern qualified arrays. */
38
39 int ext_d32_array_size [sizeof(ext_d32) == ARRAY_SIZE * sizeof(sd1) ? 1 : -1];
40 int ext_d64_array_size [sizeof(ext_d64) == ARRAY_SIZE * sizeof(dd2) ? 1 : -1];
41 int ext_d128_array_size [sizeof(ext_d128) == ARRAY_SIZE * sizeof(td3)? 1 : -1];
42
43 void f()
44 {
45 _Decimal32 d32[ARRAY_SIZE];
46 _Decimal64 d64[ARRAY_SIZE];
47 _Decimal128 d128[ARRAY_SIZE];
48
49 int d32_array_size [sizeof(d32) == ARRAY_SIZE * sizeof(_Decimal32) ? 1 : -1];
50 int d64_array_size [sizeof(d64) == ARRAY_SIZE * sizeof(_Decimal64) ? 1 : -1];
51 int d128_array_size [sizeof(d128) == ARRAY_SIZE * sizeof(_Decimal128)? 1 : -1];
52 }