commit 47ca78d3a4304750ea6c453e0847139e15c2e037
parent d6e9169830c31dc7fddd1fe21358e621cd62093b
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 23 Mar 2021 08:40:05 -0400
gen: fix qval_for_object with non-long types
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -161,11 +161,9 @@ qval_for_object(struct gen_context *ctx,
assert(0); // Invariant (lowered in check)
}
+ val->type = qtype_for_type(ctx, obj->type, true);
if (type_is_aggregate(obj->type)) {
- val->type = qtype_for_type(ctx, obj->type, true);
val->indirect = false;
- } else {
- val->type = &qbe_long; // XXX: ARCH
}
}
@@ -615,6 +613,9 @@ gen_expr_alloc(struct gen_context *ctx,
if (!type_is_aggregate(type_dealias(expr->result)->pointer.referent)) {
qval_deref(&load);
}
+ load.type = qtype_for_type(ctx,
+ type_dealias(expr->result)->pointer.referent,
+ false);
gen_expression(ctx, expr->alloc.expr, &load);
push(&ctx->current->body, &endl);
}