aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/shift-undef-long.c
blob: 326267436ec75dd62d3e9b49614e0d1a5440d3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static unsigned very_big_shift(unsigned int a)
{
	unsigned r = 0;
	r |= a << (0ULL ^ ~0U);
	r |= a << (((  signed long long) ~0U) + 1);
	r |= a << (((unsigned long long) ~0U) + 1);
	r |= a << (~((unsigned long long) ~0U));
	return r;
}

/*
 * check-name: shift-undef-long
 * check-command: sparse -m64 $file
 *
 * check-error-start
shift-undef-long.c:4:16: warning: shift too big (4294967295) for type unsigned int
shift-undef-long.c:5:16: warning: shift too big (4294967296) for type unsigned int
shift-undef-long.c:6:16: warning: shift too big (4294967296) for type unsigned int
shift-undef-long.c:7:16: warning: shift count is negative (-4294967296)
 * check-error-end
 */