From bc0db1432ed45e21a1e96383d40abb281f74784c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 14 Dec 2023 12:39:12 +0300 Subject: [PATCH] Fixed crash in case --emit-c is used together with -O0 --- ir_emit_c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ir_emit_c.c b/ir_emit_c.c index 00fc2af..c3c2d21 100644 --- a/ir_emit_c.c +++ b/ir_emit_c.c @@ -743,6 +743,10 @@ static int ir_emit_func(ir_ctx *ctx, const char *name, FILE *f) } fprintf(f, ")\n{\n"); + if (!ctx->prev_ref) { + ir_build_prev_refs(ctx); + } + /* Emit declarations for local variables */ vars = ir_bitset_malloc(ctx->vregs_count + 1); for (b = 1, bb = ctx->cfg_blocks + b; b <= ctx->cfg_blocks_count; b++, bb++) {