db/fixup_kernel.sh: update vfs_write() code
[smatch.git] / validation / sm_select.c
blob8ae2e5961e914852b05b0bff58741deee373d2bd
1 struct foo {
2 int a;
3 };
5 struct foo *a;
6 struct foo *b;
8 struct foo *c;
9 struct foo *d;
10 struct foo *e;
11 void func (void)
13 if (a?b:0) {
14 a->a = 1;
15 b->a = 1;
17 a->a = 1;
18 b->a = 1;
19 e->a = 1;
20 d = returns_nonnull();
21 if (c?d:e) {
22 c->a = 1;
23 d->a = 1;
24 e->a = 1;
26 e->a = 1;
30 * check-name: Ternary Conditions
31 * check-command: smatch sm_select.c
33 * check-output-start
34 sm_select.c:17 func() error: we previously assumed 'a' could be null (see line 13)
35 sm_select.c:18 func() error: we previously assumed 'b' could be null (see line 13)
36 sm_select.c:21 func() warn: variable dereferenced before check 'e' (see line 19)
37 sm_select.c:22 func() error: we previously assumed 'c' could be null (see line 21)
38 * check-output-end