commit ae709dc2223ef728c99e17c7e926b9b3968dbabd
parent 75925ae34f07c254ade8b59092112381045d5958
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Fri, 8 Apr 2022 02:49:34 +0200
error out on undefined measurements
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -1916,6 +1916,11 @@ check_expr_measure(struct context *ctx,
case M_SIZE:
expr->measure.dimensions = type_store_lookup_dimensions(
ctx->store, aexpr->measure.type);
+ if (expr->measure.dimensions.size == SIZE_UNDEFINED) {
+ error(ctx, aexpr->measure.value->loc, expr,
+ "Cannot take size of a type with undefined size");
+ return;
+ }
break;
case M_OFFSET:
if (aexpr->measure.value->type != EXPR_ACCESS) {