commit fa15827d851a56d6ce69476b4f0d717bd323a88c
parent 8780240eb382fd7e4b9c94975150053ddfcc267b
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 30 Jan 2021 14:40:35 -0500
gen_array: handle 0-length arrays
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -1188,6 +1188,10 @@ gen_array(struct gen_context *ctx,
const struct qbe_value *out)
{
const struct type *type = expr->result;
+ assert(type->array.length != SIZE_UNDEFINED);
+ if (type->array.length == 0) {
+ return;
+ }
// XXX: ARCH
struct qbe_value ptr = {0}, val = {0};