harec

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

commit bd1b32af9c699be04f24ef97fedb5b0b252ccdef
parent 6294e83e47c6544e86af1bc54e236737d09279b8
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 29 Dec 2020 09:48:42 -0500

gen: fix void calls

Diffstat:
Msrc/gen.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -367,15 +367,18 @@ gen_expr_call(struct gen_context *ctx, const struct qbe_value *out) { struct qbe_value result = {0}; - gen_temp(ctx, &result, qtype_for_type(ctx, - expr->call.lvalue->result->func.result, true), "returns.%d"); struct qbe_statement call = { .type = Q_INSTR, .instr = Q_CALL, - .out = qval_dup(&result), }; + if (expr->call.lvalue->result->func.result != &builtin_type_void) { + gen_temp(ctx, &result, qtype_for_type(ctx, + expr->call.lvalue->result->func.result, true), "returns.%d"); + call.out = qval_dup(&result); + } + struct qbe_arguments *arg, **next = &call.args; struct call_argument *carg = expr->call.args; arg = *next = xcalloc(1, sizeof(struct qbe_arguments));