db/fixup_kernel.sh: commit all my stuff
[smatch.git] / validation / sm_indirection2.c
blobf4e7b2681457eea334f42142e3577c4a9311084b
1 #include "check_debug.h"
3 struct foo {
4 int a, b, c;
5 };
7 struct bar {
8 struct foo *foo;
9 };
11 struct foo *get_foo(struct bar *bar)
13 return bar->foo;
16 void frob(struct bar *bar)
18 struct foo *f = bar->foo;
19 f->a = 5;
22 int test(struct bar *bar)
24 struct foo *f = get_foo(bar);
26 f->a = 1;
27 frob(bar);
28 __smatch_implied(bar->foo->a);
29 __smatch_implied(f->a);
31 return 0;
35 * check-name: smatch: indirection #2
36 * check-command: smatch -I.. sm_indirection2.c
38 * check-output-start
39 sm_indirection2.c:28 test() implied: bar->foo->a = '5'
40 sm_indirection2.c:29 test() implied: f->a = '5'
41 * check-output-end