function_hooks/unwind: introduce return_implies_exact()
[smatch.git] / validation / sm_mtag7.c
blobf9eccfa774a252ce5050ed3636e0d50bc78ca199
1 #include <stdio.h>
2 #include "check_debug.h"
4 struct foo {
5 int (*func)(struct foo *);
6 int a, b, c;
7 int *p;
8 };
10 int frob1(struct foo *p)
12 __smatch_implied(*p->p);
15 int frob2(struct foo *p)
17 __smatch_implied(*p->p);
20 int x = 42;
21 int y = 43;
23 struct foo aaa = {
24 .func = frob1,
25 .a = 1, .b = 2, .c = 3,
26 .p = &x,
28 struct foo bbb = {
29 .func = frob2,
30 .a = 10, .b = 11, .c = 13,
31 .p = &y,
34 int main(void)
36 aaa.func(&aaa);
37 bbb.func(&bbb);
38 return 0;
42 * check-name: smatch mtag #7
43 * check-command: validation/smatch_db_test.sh -I.. sm_mtag7.c
45 * check-output-start
46 sm_mtag7.c:12 frob1() implied: *p->p = '42'
47 sm_mtag7.c:17 frob2() implied: *p->p = '43'
48 * check-output-end