aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-11 18:20:51 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-11 18:20:51 +0200
commit65ba62230b88bcc2d570418b88f2dc0152822a36 (patch)
tree33350243392dc422ebd16e2d4d4ab74048028050
parent9554805cc1baecf0f4f47b3537078f68b37dd4e0 (diff)
parent6ed98066f6d184f2f0f918570aaa6a1934668ac2 (diff)
downloadsparse-65ba62230b88bcc2d570418b88f2dc0152822a36.tar.gz
Merge branch 'force-to-0' into master
* force to 0 expressions which are erroneously non-constant
-rw-r--r--expand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/expand.c b/expand.c
index 623b1800..c4f806de 100644
--- a/expand.c
+++ b/expand.c
@@ -1177,8 +1177,12 @@ static void expand_const_expression(struct expression *expr, const char *where)
{
if (expr) {
expand_expression(expr);
- if (expr->type != EXPR_VALUE)
+ if (expr->type != EXPR_VALUE) {
expression_error(expr, "Expected constant expression in %s", where);
+ expr->ctype = &int_ctype;
+ expr->type = EXPR_VALUE;
+ expr->value = 0;
+ }
}
}