xref: /illumos-gate/usr/src/tools/smatch/src/validation/sm_compound_condition.c (revision 1f5207b7604fb44407eb4342aff613f7c4508508)
1*1f5207b7SJohn Levon struct ture {
2*1f5207b7SJohn Levon 	int a;
3*1f5207b7SJohn Levon };
4*1f5207b7SJohn Levon 
5*1f5207b7SJohn Levon struct ture *a;
6*1f5207b7SJohn Levon struct ture *b;
7*1f5207b7SJohn Levon 
func(void)8*1f5207b7SJohn Levon void func (void)
9*1f5207b7SJohn Levon {
10*1f5207b7SJohn Levon 	if (!a && !(a = returns_nonnull()))
11*1f5207b7SJohn Levon 		return;
12*1f5207b7SJohn Levon 	a->a = 1;
13*1f5207b7SJohn Levon 
14*1f5207b7SJohn Levon 	if (b || (b = returns_nonnull())) {
15*1f5207b7SJohn Levon 		b->a  = 1;
16*1f5207b7SJohn Levon 		return;
17*1f5207b7SJohn Levon 	}
18*1f5207b7SJohn Levon 	b->a = 1;
19*1f5207b7SJohn Levon }
20*1f5207b7SJohn Levon /*
21*1f5207b7SJohn Levon  * check-name: Compound Conditions
22*1f5207b7SJohn Levon  * check-command: smatch sm_compound_condition.c
23*1f5207b7SJohn Levon  *
24*1f5207b7SJohn Levon  * check-output-start
25*1f5207b7SJohn Levon sm_compound_condition.c:18 func() error: we previously assumed 'b' could be null (see line 14)
26*1f5207b7SJohn Levon  * check-output-end
27*1f5207b7SJohn Levon  */
28