aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-16 17:53:42 +0200
committerlemon <lsof@mailbox.org>2025-10-16 17:53:42 +0200
commitd051c17c70c86b3c9bbc0a0761203d97e8c662d0 (patch)
tree0a4b1e27b5a7ef3092a476952727def0900d496a /c.c
parent77b13b42643991fc8c2b8942ca167eb7bf156908 (diff)
various little bugs
Diffstat (limited to 'c.c')
-rw-r--r--c.c7
1 files changed, 4 insertions, 3 deletions
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);