xref: /illumos-gate/usr/src/tools/smatch/src/validation/sm_inline1.c (revision c559157643fef9f9afb0414e00a3579407ba3052)
1 #include <stdio.h>
2 #include <string.h>
3 #include "check_debug.h"
4 
5 int frob(int *x)
6 {
7 	*x = *x * 3;
8 	return 0;
9 }
10 
11 int *x;
12 int y;
13 int main(void)
14 {
15 	*x = 1;
16 	frob(x);
17 	__smatch_implied(*x);
18 	frob(x);
19 	__smatch_implied(*x);
20 
21 	y = 2;
22 	frob(&y);
23 	__smatch_implied(y);
24 	frob(&y);
25 	__smatch_implied(y);
26 
27 	return 0;
28 }
29 
30 
31 /*
32  * check-name: smatch: inline #1
33  * check-command: smatch -I.. sm_inline1.c
34  *
35  * check-output-start
36 sm_inline1.c:17 main() implied: *x = '3'
37 sm_inline1.c:19 main() implied: *x = '9'
38 sm_inline1.c:23 main() implied: y = '6'
39 sm_inline1.c:25 main() implied: y = '18'
40  * check-output-end
41  */
42