aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-01-31 12:35:30 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-01 15:23:25 +0100
commit0687a6f961540a472161b183cc927262454d2186 (patch)
tree7d2f781cf4bd3309bb10ce577daf38b5709e5344
parent56641060b08a51d582c6ebb6b2ce45c84b8ac467 (diff)
downloadsparse-dev-0687a6f961540a472161b183cc927262454d2186.tar.gz
fix error in bad conditional
Commit "b5867a33b (fix evaluation of a function or array symbol in conditionals)" added a missing call to degenerate(epxr) but this must not be done if the expression is erroneous. fix this by bypassing the call to degenerate() if the ctype is NULL. Fixes: b5867a33b62c04811784c6fc233c601a4f2b0841 Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c4
-rw-r--r--validation/bad-type-twice0.c1
2 files changed, 3 insertions, 2 deletions
diff --git a/evaluate.c b/evaluate.c
index 402fa04a..02799398 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -894,7 +894,9 @@ static struct symbol *evaluate_conditional(struct expression *expr, int iterator
ctype = NULL;
}
}
- ctype = degenerate(expr);
+
+ if (ctype)
+ ctype = degenerate(expr);
return ctype;
}
diff --git a/validation/bad-type-twice0.c b/validation/bad-type-twice0.c
index 2dbc91b0..7a9073c5 100644
--- a/validation/bad-type-twice0.c
+++ b/validation/bad-type-twice0.c
@@ -5,7 +5,6 @@ static int foo(a)
/*
* check-name: bad-type-twice0
- * check-known-to-fail
*
* check-error-start
bad-type-twice0.c:3:16: error: incorrect type in conditional