math: cleanup. separate handle_preop() into it's own function
[smatch.git] / validation / sm_casts.c
blobbe649c4c1cc5b1a06aa47931b04b9355488152ba
1 void frob(void);
3 static int options_write(void)
5 char a;
6 unsigned char b;
7 char c;
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 +10 options_write(7) warn: value 255 can't fit into 127 'a'
30 sm_casts.c +11 options_write(8) warn: value 255 can't fit into 127 'b'
31 sm_casts.c +13 options_write(10) warn: -400 is less than -128 (min 'c' can be) so this is always true.
32 sm_casts.c +15 options_write(12) warn: -400 is less than -128 (min 'c' can be) so this is always false.
33 sm_casts.c +17 options_write(14) warn: 400 is more than 127 (max 'c' can be) so this is always true.
34 sm_casts.c +19 options_write(16) warn: -400 is less than -128 (min 'c' can be) so this is always false.
35 sm_casts.c +21 options_write(18) warn: assigning -12 to unsigned variable 'b'
36 * check-output-end