update validation tests
[smatch.git] / validation / sm_deref_check_deref.c
blob6e556b80c7242a972873133821706f1499e1634d
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(9) warn: variable dereferenced before check 'px'
35 sm_deref_check_deref.c +24 func(13) warn: variable dereferenced before check 'y'
36 * check-output-end