1*1f5207b7SJohn Levon void frob(void); 2*1f5207b7SJohn Levon 3*1f5207b7SJohn Levon char c; options_write(void)4*1f5207b7SJohn Levonstatic int options_write(void) 5*1f5207b7SJohn Levon { 6*1f5207b7SJohn Levon char a; 7*1f5207b7SJohn Levon unsigned char b; 8*1f5207b7SJohn Levon 9*1f5207b7SJohn Levon a = (char)0xff; 10*1f5207b7SJohn Levon a = 0xff; 11*1f5207b7SJohn Levon (char)b = 0xff; 12*1f5207b7SJohn Levon b = 0xff; 13*1f5207b7SJohn Levon if (c > -400) 14*1f5207b7SJohn Levon frob(); 15*1f5207b7SJohn Levon if (c < -400) 16*1f5207b7SJohn Levon frob(); 17*1f5207b7SJohn Levon if (400 > c) 18*1f5207b7SJohn Levon frob(); 19*1f5207b7SJohn Levon if (-400 > c) 20*1f5207b7SJohn Levon frob(); 21*1f5207b7SJohn Levon b = -12; 22*1f5207b7SJohn Levon 23*1f5207b7SJohn Levon } 24*1f5207b7SJohn Levon /* 25*1f5207b7SJohn Levon * check-name: smatch cast handling 26*1f5207b7SJohn Levon * check-command: smatch sm_casts.c 27*1f5207b7SJohn Levon * 28*1f5207b7SJohn Levon * check-output-start 29*1f5207b7SJohn Levon sm_casts.c:13 options_write() warn: always true condition '(c > -400) => ((-128)-127 > (-400))' 30*1f5207b7SJohn Levon sm_casts.c:15 options_write() warn: impossible condition '(c < -400) => ((-128)-127 < (-400))' 31*1f5207b7SJohn Levon sm_casts.c:17 options_write() warn: always true condition '(400 > c) => (400 > (-128)-127)' 32*1f5207b7SJohn Levon sm_casts.c:19 options_write() warn: impossible condition '(-400 > c) => ((-400) > (-128)-127)' 33*1f5207b7SJohn Levon sm_casts.c:21 options_write() warn: assigning (-12) to unsigned variable 'b' 34*1f5207b7SJohn Levon * check-output-end 35*1f5207b7SJohn Levon */ 36