commit b3dcc9351c71463382e3b99b6b5c3d4c581d57d8
parent 3f0e36cf9eb59146d02c7b2c22e23385e02e9a61
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 1 Feb 2021 10:05:30 -0500
gen: fix addressing of aggregate objects
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -408,6 +408,7 @@ address_index(struct gen_context *ctx,
constl(&temp, atype->array.members->size);
pushi(ctx->current, &index, Q_MUL, &index, &temp, NULL);
pushi(ctx->current, out, Q_ADD, out, &index, NULL);
+ out->type = qtype_for_type(ctx, atype->array.members, false);
if (!type_is_aggregate(atype->array.members)) {
qval_deref(out);
}
@@ -954,7 +955,7 @@ gen_cast_to_tagged(struct gen_context *ctx,
} else {
pushi(ctx->current, &ptr, Q_ADD, &ptr, &offs, NULL);
ptr.type = qtype_for_type(ctx, expr->cast.value->result, false);
- ptr.indirect = !type_is_aggregate(expr->cast.value->result);
+ qval_deref(&ptr);
storage = &ptr;
}