commit b164f4678a9cdbc52c96c5b8ddcffcfac8b27c2b
parent bbd01c3002170a72e7d82fdabd60dedd0cca9ae4
Author: Karl Schultheisz <k@kdsch.org>
Date: Sun, 15 May 2022 09:51:23 -0400
type_store: reject zero struct field alignment
Fixes a floating-point exception for code such as
type a = struct{[*]: b};
where b is an unresolved type.
Signed-off-by: Karl Schultheisz <k@kdsch.org>
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -176,6 +176,10 @@ struct_insert_field(struct type_store *store, struct struct_field **fields,
error(store->check_context, atype->type->loc,
"Struct field size cannot be zero");
return NULL;
+ } else if (dim.align == 0) {
+ error(store->check_context, atype->type->loc,
+ "Struct field alignment cannot be zero");
+ return NULL;
}
if (atype->offset) {