xref: /illumos-gate/usr/src/tools/smatch/src/validation/shift-undef-long.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)

very_big_shift(unsigned int a)1 static unsigned very_big_shift(unsigned int a)
2 {
3 	unsigned r = 0;
4 	r |= a << (0ULL ^ ~0U);
5 	r |= a << (((  signed long long) ~0U) + 1);
6 	r |= a << (((unsigned long long) ~0U) + 1);
7 	r |= a << (~((unsigned long long) ~0U));
8 	return r;
9 }
10 
11 /*
12  * check-name: shift-undef-long
13  * check-command: sparse -m64 $file
14  *
15  * check-error-start
16 shift-undef-long.c:4:16: warning: shift too big (4294967295) for type unsigned int
17 shift-undef-long.c:5:16: warning: shift too big (4294967296) for type unsigned int
18 shift-undef-long.c:6:16: warning: shift too big (4294967296) for type unsigned int
19 shift-undef-long.c:7:16: warning: shift count is negative (-4294967296)
20  * check-error-end
21  */
22