hooks: add a warning to detect unimplemented hooks
[smatch.git] / validation / expand / bad-shift.c
blobb68866c2b048b4aaec5f6af214404a43da72d720
1 #define MAX (sizeof(int) * __CHAR_BIT__)
3 static int lmax(int a)
5 return 1 << MAX;
8 static int lneg(int a)
10 return 1 << -1;
13 static int rmax(int a)
15 return 1 >> MAX;
18 static int rneg(int a)
20 return 1 >> -1;
24 * check-name: bad-shift
25 * check-command: test-linearize -Wno-decl $file
27 * check-output-start
28 lmax:
29 .L0:
30 <entry-point>
31 shl.32 %r1 <- $1, $32
32 ret.32 %r1
35 lneg:
36 .L2:
37 <entry-point>
38 shl.32 %r3 <- $1, $0xffffffff
39 ret.32 %r3
42 rmax:
43 .L4:
44 <entry-point>
45 asr.32 %r5 <- $1, $32
46 ret.32 %r5
49 rneg:
50 .L6:
51 <entry-point>
52 asr.32 %r7 <- $1, $0xffffffff
53 ret.32 %r7
56 * check-output-end
58 * check-error-start
59 expand/bad-shift.c:5:21: warning: shift too big (32) for type int
60 expand/bad-shift.c:10:21: warning: shift count is negative (-1)
61 expand/bad-shift.c:15:21: warning: shift too big (32) for type int
62 expand/bad-shift.c:20:21: warning: shift count is negative (-1)
63 * check-error-end