rosenberg: handle bit fields better
[smatch.git] / validation / packed-bitfield3.c
blob13368c84469ef1081a95f0e240dcd6054b169389
1 #define __packed __attribute__((packed))
3 typedef unsigned char u8;
4 typedef __UINT16_TYPE__ u16;
5 typedef __UINT32_TYPE__ u32;
6 typedef __UINT64_TYPE__ u64;
8 struct b {
9 u32 a:1;
10 u32 b:2;
11 u32 c:4;
12 u32 d:8;
13 u32 e:16;
14 } __packed;
15 _Static_assert(__alignof(struct b) == 1);
16 _Static_assert( sizeof(struct b) == 4);
18 struct c {
19 u8 a;
20 u8 b;
21 u64 c:48;
22 } __packed;
23 _Static_assert(__alignof(struct c) == 1);
24 _Static_assert( sizeof(struct c) == 8);
27 * check-name: packed-bitfield3