aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/foul-bitwise.c
blob: 9e21eab7bf2f41d65c7f9083873b41504c1ff5ae (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
typedef unsigned short __attribute__((bitwise))__le16;
static __le16 foo(__le16 a)
{
	return a |= ~a;
}

static int baz(__le16 a)
{
	return ~a == ~a;
}

static int barf(__le16 a)
{
	return a == (a & ~a);
}

static __le16 bar(__le16 a)
{
	return -a;
}

/*
 * check-name: foul bitwise
 * check-error-start
foul-bitwise.c:9:16: warning: restricted __le16 degrades to integer
foul-bitwise.c:9:22: warning: restricted __le16 degrades to integer
foul-bitwise.c:19:16: error: incompatible types for operation (-)
foul-bitwise.c:19:16:    argument has type restricted __le16 [usertype] a
 * check-error-end
 */