aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c
new file mode 100644
index 000000000..7ea994da4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/c11-align-6.c
@@ -0,0 +1,40 @@
+/* Test C11 _Alignof returning minimum alignment for a type. PR
+ 52023. */
+/* { dg-do run } */
+/* { dg-options "-std=c11" } */
+
+extern void abort (void);
+extern void exit (int);
+
+#define CHECK_ALIGN(TYPE) \
+ do \
+ { \
+ struct { char c; TYPE v; } x; \
+ if (_Alignof (TYPE) > __alignof__ (x.v)) \
+ abort (); \
+ } \
+ while (0)
+
+int
+main (void)
+{
+ CHECK_ALIGN (_Bool);
+ CHECK_ALIGN (char);
+ CHECK_ALIGN (signed char);
+ CHECK_ALIGN (unsigned char);
+ CHECK_ALIGN (signed short);
+ CHECK_ALIGN (unsigned short);
+ CHECK_ALIGN (signed int);
+ CHECK_ALIGN (unsigned int);
+ CHECK_ALIGN (signed long);
+ CHECK_ALIGN (unsigned long);
+ CHECK_ALIGN (signed long long);
+ CHECK_ALIGN (unsigned long long);
+ CHECK_ALIGN (float);
+ CHECK_ALIGN (double);
+ CHECK_ALIGN (long double);
+ CHECK_ALIGN (_Complex float);
+ CHECK_ALIGN (_Complex double);
+ CHECK_ALIGN (_Complex long double);
+ exit (0);
+}