aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/bitfield-sizes.c
blob: 9f76d07418a5cc7edef20767d41607716193802d (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
29
30
struct a {
	int  a:31;
	int  b:32;
	long c:63;
	long d:64;
	int  x:33;		// KO
	long y:65;		// KO
};
static struct a a;

struct b {
	int m1:-1;		// KO
	int x1:2147483648;	// KO
	int :0;
	int a0:0;		// KO
};
static struct b b;

/*
 * check-name: bitfield-sizes
 * check-command: sparse -m64 $file
 *
 * check-error-start
bitfield-sizes.c:12:18: error: bitfield 'm1' has invalid width (-1)
bitfield-sizes.c:13:26: error: bitfield 'x1' has invalid width (2147483648)
bitfield-sizes.c:15:17: error: bitfield 'a0' has invalid width (0)
bitfield-sizes.c:6:15: error: bitfield 'x' is wider (33) than its type (int)
bitfield-sizes.c:7:15: error: bitfield 'y' is wider (65) than its type (long)
 * check-error-end
 */