harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b83bbfd0855cc65db0b7b8fd8f03a1a85e4b8a07
parent 6efeb064ac2a2ca743dc0a75596bc6bdbd4072f7
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 24 Dec 2020 12:06:02 -0500

gen: alloc_temp: fix type of indirect value

Diffstat:
Msrc/emit.c | 6+++++-
Msrc/gen.c | 1+
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/emit.c b/src/emit.c @@ -77,7 +77,11 @@ emit_stmt(struct qbe_statement *stmt, FILE *out) emit_value(stmt->out, out); fprintf(out, " ="); assert(stmt->out->type->stype != Q__AGGREGATE); // TODO - emit_qtype(stmt->out->type, out); + if (stmt->out->indirect) { + emit_qtype(&qbe_long, out); // XXX: ARCH + } else { + emit_qtype(stmt->out->type, out); + } fprintf(out, " "); } fprintf(out, "%s%s", qbe_instr[stmt->instr], diff --git a/src/gen.c b/src/gen.c @@ -52,6 +52,7 @@ alloc_temp(struct gen_context *ctx, struct qbe_value *val, { gen_temp(ctx, val, &qbe_long, fmt); // XXX: Architecture dependent val->indirect = true; + val->type = qtype_for_type(ctx, type, false); struct qbe_value size; constl(&size, type->size);