1 #include "check_debug.h"
   2 
   3 struct foo {
   4         int a, b, c;
   5 };
   6 
   7 struct bar {
   8         struct foo *foo;
   9 };
  10 
  11 struct foo *get_foo(struct bar *bar)
  12 {
  13         return bar->foo;
  14 }
  15 
  16 void frob(struct bar *bar)
  17 {
  18         struct foo *f = bar->foo;
  19         f->a = 5;
  20 }
  21 
  22 int test(struct bar *bar)
  23 {
  24         struct foo *f = get_foo(bar);
  25 
  26         f->a = 1;
  27         frob(bar);
  28         __smatch_implied(bar->foo->a);
  29         __smatch_implied(f->a);
  30 
  31         return 0;
  32 }
  33 
  34 /*
  35  * check-name: smatch: indirection #2
  36  * check-command: smatch -I.. sm_indirection2.c
  37  *
  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
  42  */