1 #define __packed	__attribute__((packed))
2 
3 struct s {
4 	unsigned int f0:1;
5 	unsigned int f1:1;
6 	unsigned int pad:6;
7 } __packed;
8 _Static_assert(sizeof(struct s) == 1,  "sizeof(struct s)");
9 
10 extern struct s g;
11 
foo(struct s *ptr)12 static int foo(struct s *ptr)
13 {
14 	int f = 0;
15 
16 	f += g.f0;
17 	f += g.f1;
18 
19 	f += ptr->f0;
20 	f += ptr->f1;
21 
22 	return f;
23 }
24 
25 /*
26  * check-name: packed-bitfield1
27  */
28