1unsigned int fn1(unsigned int a) { return a >> -1; }
2unsigned int fn2(unsigned int a) { return a >> ~0; }
3
4unsigned int fo1(unsigned int a) { return a >> ((a & 0) | -1); }
5unsigned int fo2(unsigned int a) { return a >> ((a & 0) ^ ~0); }
6
7/*
8 * check-name: shift-negative
9 * check-command: sparse -Wno-decl $file
10 *
11 * check-error-start
12shift-negative.c:1:48: warning: shift count is negative (-1)
13shift-negative.c:2:48: warning: shift count is negative (-1)
14shift-negative.c:4:59: warning: shift count is negative (-1)
15shift-negative.c:5:59: warning: shift count is negative (-1)
16 * check-error-end
17 */
18