commit c1684d24b9f1c44f2262315b22301fff3e173b4c
parent f9132effef31c1eb0220c5dd3278fe747e91b893
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 4 Aug 2021 12:36:06 +0200
gen: fix terminating function bodies
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -805,7 +805,7 @@ gen_function_decl(struct gen_context *ctx, const struct declaration *decl)
struct gen_value ret = gen_expr(ctx, decl->func.body);
if (decl->func.body->terminates) {
- // Do nothing
+ pushi(ctx->current, NULL, Q_RET, NULL);
} else if (type_dealias(fntype->func.result)->storage != STORAGE_VOID) {
struct qbe_value qret = mkqval(ctx, &ret);
pushi(ctx->current, NULL, Q_RET, &qret, NULL);