xref: /illumos-gate/usr/src/tools/smatch/src/validation/sm_mtag4.c (revision 44bf619d328827ce5eca6833fcd5c69f1592e578)
1 #include <stdio.h>
2 #include "check_debug.h"
3 
4 struct foo {
5 	int a, b, c;
6 	int (*func)(int *p);
7 	void (*func2)(int a);
8 	void *data;
9 };
10 
11 static void frob_int1(int val)
12 {
13 	__smatch_implied(val);
14 }
15 
16 static void frob_int2(int val)
17 {
18 	__smatch_implied(val);
19 }
20 
21 static struct foo one_struct = {
22 	.b = 41,
23 	.func2 = frob_int1,
24 };
25 
26 static struct foo two_struct = {
27 	.b = 42,
28 	.func2 = frob_int2,
29 };
30 
31 struct foo *unknown(void);
32 struct foo *p;
33 
34 int main(void)
35 {
36 	int ret;
37 
38 	p = unknown();
39 	p->func2(p->b);
40 
41 	return 0;
42 }
43 
44 /*
45  * check-name: smatch mtag #4
46  * check-command: validation/smatch_db_test.sh -I.. sm_mtag4.c
47  *
48  * check-output-start
49 sm_mtag4.c:13 frob_int1() implied: val = '41'
50 sm_mtag4.c:18 frob_int2() implied: val = '42'
51  * check-output-end
52  */
53