From d051c17c70c86b3c9bbc0a0761203d97e8c662d0 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 16 Oct 2025 17:53:42 +0200 Subject: various little bugs --- c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'c.c') diff --git a/c.c b/c.c index c214ced..62e8bbe 100644 --- a/c.c +++ b/c.c @@ -3423,12 +3423,12 @@ genswitch(struct comp *cm, struct function *fn, const struct expr *ex) EMITS { struct block *next = i < st.cases.n - 1 ? newblk(fn) : st.bdefault; putcondbranch(fn, addinstr(fn, mkinstr(Oequ, k, .l = sel, .r = mkintcon(k, c.val))), c.blk, next); - useblk(fn, next); + if (next != st.bdefault) useblk(fn, next); } } vfree(&st.cases); if (fn->curblk != end) { - EMITS putbranch(fn, end); + if (fn->curblk) EMITS putbranch(fn, end); useblk(fn, end); } } @@ -3517,7 +3517,8 @@ stmt(struct comp *cm, struct function *fn) terminates = 0; } else { EMITS { - if (!terminates) putbranch(fn, end = newblk(fn)); + end = newblk(fn); + if (!terminates) putbranch(fn, end); useblk(fn, fl); } terminates &= stmt(cm, fn); -- cgit v1.2.3