Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / c11-align-6.c
blob7ea994da4007728fc7b2107217f4edbbba853efa
1 /* Test C11 _Alignof returning minimum alignment for a type. PR
2 52023. */
3 /* { dg-do run } */
4 /* { dg-options "-std=c11" } */
6 extern void abort (void);
7 extern void exit (int);
9 #define CHECK_ALIGN(TYPE) \
10 do \
11 { \
12 struct { char c; TYPE v; } x; \
13 if (_Alignof (TYPE) > __alignof__ (x.v)) \
14 abort (); \
15 } \
16 while (0)
18 int
19 main (void)
21 CHECK_ALIGN (_Bool);
22 CHECK_ALIGN (char);
23 CHECK_ALIGN (signed char);
24 CHECK_ALIGN (unsigned char);
25 CHECK_ALIGN (signed short);
26 CHECK_ALIGN (unsigned short);
27 CHECK_ALIGN (signed int);
28 CHECK_ALIGN (unsigned int);
29 CHECK_ALIGN (signed long);
30 CHECK_ALIGN (unsigned long);
31 CHECK_ALIGN (signed long long);
32 CHECK_ALIGN (unsigned long long);
33 CHECK_ALIGN (float);
34 CHECK_ALIGN (double);
35 CHECK_ALIGN (long double);
36 CHECK_ALIGN (_Complex float);
37 CHECK_ALIGN (_Complex double);
38 CHECK_ALIGN (_Complex long double);
39 exit (0);