commit 80be7056f97af15bc321c0b54a9f6d3443bd0078
parent 6a2068efb1bd5bc61794ab6e9715a4288caf8929
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 24 Dec 2020 11:10:41 -0500
Fix indirect temporary allocations
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -51,6 +51,7 @@ alloc_temp(struct gen_context *ctx, struct qbe_value *val,
const struct type *type, const char *fmt)
{
gen_temp(ctx, val, &qbe_long, fmt); // XXX: Architecture dependent
+ val->indirect = true;
struct qbe_value size;
constl(&size, type->size);
@@ -512,7 +513,7 @@ gen_function_decl(struct gen_context *ctx, const struct declaration *decl)
};
ctx->end_label = &end_label_v;
- struct qbe_value rval;
+ struct qbe_value rval = {0};
if (fntype->func.result->storage != TYPE_STORAGE_VOID) {
alloc_temp(ctx, &rval, fntype->func.result, "ret.%d");
ctx->return_value = &rval;