1 /* { dg-do run { target { pcc_bitfield_type_matters || default_packed } } } */
3 /* Check bitfields and non-bitfields are aligned & sized similarly.
5 Copyright (C) 2002 Free Software Foundation Inc
6 Contributed by Nathan Sidwell <nathan@codesourcery.com>
14 #define CHECK1(N, T) do { \
15 typedef struct Field_##N { char c; T f; } Field_##N; \
16 typedef struct BitField_##N { char c; T f : sizeof (T) * CHAR_BIT; } BitField_##N; \
17 if (sizeof (Field_##N) != sizeof (BitField_##N)) { \
18 fail = 1; printf ("sizeof %s failed\n", #T); \
20 if (__alignof__ (Field_##N) != __alignof__ (BitField_##N)) { \
21 fail = 1; printf ("__alignof__ %s failed\n", #T); \
25 #define CHECK(N, T) do { \
27 CHECK1 (s##N, signed T); \
28 CHECK1 (u##N, unsigned T); \
38 CHECK (ll, long long);