xref: /illumos-gate/usr/src/tools/smatch/src/validation/kill-replaced-insn.c (revision f52943a93040563107b95bccb9db87d9971ef47d)
1 // See if the replaced operation is effectively killed or not
2 
3 static int kill_add(int a, int b)
4 {
5 	return (a + b) && 0;
6 }
7 
8 static int kill_scast(short a)
9 {
10 	return ((int) a) && 0;
11 }
12 
13 static int kill_ucast(unsigned char a)
14 {
15 	return ((int) a) && 0;
16 }
17 
18 static int kill_pcast(int *a)
19 {
20 	return ((void*) a) && 0;
21 }
22 
23 static int kill_fcast(double a)
24 {
25 	return ((int) a) && 0;
26 }
27 
28 static int kill_select(int a)
29 {
30 	return (a ? 1 : 0) && 0;
31 }
32 
33 static int kill_setval(int a)
34 {
35 l:
36 	return &&l && 0;
37 }
38 
39 static int kill_load(int *a)
40 {
41 	return *a && 0;
42 }
43 
44 static int kill_store(int *a)
45 {
46 	return (*a = 1) && 0;
47 }
48 
49 /*
50  * check-name: kill-replaced-insn
51  * check-command: test-linearize $file
52  *
53  * check-output-ignore
54  * check-output-excludes: add\\.
55  * check-output-excludes: scast\\.
56  * check-output-excludes: \\<cast\\.
57  * check-output-excludes: ptrcast\\.
58  * check-output-excludes: fpcast\\.
59  * check-output-excludes: sel\\.
60  * check-output-excludes: set\\.
61  */
62