side_effects: the iterate_all_kinds() macro has side effects deliberately
[smatch.git] / validation / sm_deref_check_deref.c
blob5e4b2cde111b7703a7771ad20bf0f0842ce00e99
1 struct ture {
2 int a;
3 };
4 struct cont {
5 struct ture *x;
6 };
8 struct ture *x;
9 struct ture **px;
10 struct cont *y;
11 void func (void)
13 int *a = &(x->a);
14 int *b = &x->a;
15 int *c = &(y->x->a);
16 int *d = &((*px)->a);
18 if (x)
19 frob();
20 if (px)
21 frob();
22 if (y->x)
23 frob();
24 if (y)
25 frob();
27 return;
30 * check-name: Dereferencing before check
31 * check-command: smatch sm_deref_check_deref.c
33 * check-output-start
34 sm_deref_check_deref.c:20 func() warn: variable dereferenced before check 'px' (see line 16)
35 sm_deref_check_deref.c:24 func() warn: variable dereferenced before check 'y' (see line 15)
36 * check-output-end