aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/packed-bitfield1.c
blob: 208a3dc5127c1bc5992639df16d46724da19bde5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#define __packed	__attribute__((packed))

struct s {
	unsigned int f0:1;
	unsigned int f1:1;
	unsigned int pad:6;
} __packed;
_Static_assert(sizeof(struct s) == 1,  "sizeof(struct s)");

extern struct s g;

static int foo(struct s *ptr)
{
	int f = 0;

	f += g.f0;
	f += g.f1;

	f += ptr->f0;
	f += ptr->f1;

	return f;
}

/*
 * check-name: packed-bitfield1
 * check-known-to-fail
 */