aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--expand.c6
-rw-r--r--validation/linear/bug-assign-op0.c10
2 files changed, 10 insertions, 6 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;
+ }
}
}
diff --git a/validation/linear/bug-assign-op0.c b/validation/linear/bug-assign-op0.c
index b351bb51..3a2bef3c 100644
--- a/validation/linear/bug-assign-op0.c
+++ b/validation/linear/bug-assign-op0.c
@@ -10,7 +10,7 @@ unsigned int lsr(unsigned int u)
return u;
}
-int divr(int s, unsigned long u)
+int divr(int s, unsigned long long u)
{
extern int use(int, unsigned);
int t = s;
@@ -19,25 +19,25 @@ int divr(int s, unsigned long u)
return use(s, u);
}
-int sdivul(int s, unsigned long u)
+int sdivul(int s, unsigned long long u)
{
s /= u; // divu
return s;
}
-unsigned int udivsl(unsigned int u, long s)
+unsigned int udivsl(unsigned int u, long long s)
{
u /= s; // divs
return u;
}
-int uldivs(int s, unsigned long u)
+int uldivs(int s, unsigned long long u)
{
u /= s; // divu
return u;
}
-unsigned int sldivu(unsigned int u, long s)
+unsigned int sldivu(unsigned int u, long long s)
{
s /= u; // divs
return s;