1 struct foo { 2 int a; 3 }; 4 5 struct foo *a; 6 struct foo *b; 7 8 struct foo *c; 9 struct foo *d; 10 struct foo *e; 11 void func (void) 12 { 13 if (a?b:0) { 14 a->a = 1; 15 b->a = 1; 16 } 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; 25 } 26 e->a = 1; 27 } 28 29 /* 30 * check-name: Ternary Conditions 31 * check-command: smatch sm_select.c 32 * 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 39 */ 40 41