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 int frob1(int *val)
12 {
13 __smatch_implied(*val);
14 return *val + 1;
15 }
16
17 static int frob2(int *val)
18 {
19 __smatch_implied(*val);
20 return *val + 1;
21 }
22
23 static struct foo one_struct = {
24 .a = 1,
25 .func = frob1,
26 };
27
28 static struct foo two_struct = {
29 .a = 2,
30 .func = frob2,
31 };
32
33 struct foo *unknown(void);
34 struct foo *p;
35
36 int main(void)
37 {
38 int ret;
39
40 p = unknown();
41 ret = p->func(&p->a);
42
43 return 0;
44 }
45
46 /*
47 * check-name: smatch mtag #2
48 * check-command: validation/smatch_db_test.sh -I.. sm_mtag2.c
49 *
50 * check-output-start
51 sm_mtag2.c:13 frob1() implied: *val = '1'
52 sm_mtag2.c:19 frob2() implied: *val = '2'
53 * check-output-end
54 */