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