db: don't print "failed to open" warnings...
[smatch.git] / validation / sm_casts.c
blob3e712c00600ada61f5f5374e8a37c89c3f354bac
1 void frob(void);
3 char c;
4 static int options_write(void)
6 char a;
7 unsigned char b;
9 a = (char)0xff;
10 a = 0xff;
11 (char)b = 0xff;
12 b = 0xff;
13 if (c > -400)
14 frob();
15 if (c < -400)
16 frob();
17 if (400 > c)
18 frob();
19 if (-400 > c)
20 frob();
21 b = -12;
25 * check-name: smatch cast handling
26 * check-command: smatch sm_casts.c
28 * check-output-start
29 sm_casts.c:13 options_write() warn: always true condition '(c > -400) => ((-128)-127 > (-400))'
30 sm_casts.c:15 options_write() warn: impossible condition '(c < -400) => ((-128)-127 < (-400))'
31 sm_casts.c:17 options_write() warn: always true condition '(400 > c) => (400 > (-128)-127)'
32 sm_casts.c:19 options_write() warn: impossible condition '(-400 > c) => ((-400) > (-128)-127)'
33 sm_casts.c:21 options_write() warn: assigning (-12) to unsigned variable 'b'
34 * check-output-end