aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-14 19:23:21 +0200
committerlemon <lsof@mailbox.org>2025-09-14 19:23:21 +0200
commit6cb4382b0128942f4ba57ab26021be1e5715f2bc (patch)
tree0b63731286acbe503981958930aeae93816b6b34 /c.c
parent7a318363ec4fdcd80d9d0154cef393c9bf205d5e (diff)
codegen: float cmp, ior; frontend: fix cond expr bug
Diffstat (limited to 'c.c')
-rw-r--r--c.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/c.c b/c.c
index 2d484c4..d7a9ff6 100644
--- a/c.c
+++ b/c.c
@@ -2531,7 +2531,6 @@ condexprrec(struct function *fn, const struct expr *ex, struct condphis *phis,
int boolcon, struct block *const next, struct block *end)
{
struct block *tr, *fl;
- union ref r;
while (ex->t == ESEQ) {
expreffects(fn, &ex->sub[0]);
ex = &ex->sub[1];
@@ -2555,16 +2554,16 @@ condexprrec(struct function *fn, const struct expr *ex, struct condphis *phis,
useblk(fn, fl);
condexprrec(fn, &ex->sub[2], phis, -1, end, end);
} else {
- r = exprvalue(fn, ex);
+ union ref r = exprvalue(fn, ex), val = r;
if (boolcon >= 0) {
if (!next || next == end) {
boolcon = -1;
- r = cvt(fn, TYBOOL, ex->ty.t, r);
+ val = cvt(fn, TYBOOL, ex->ty.t, r);
} else {
- r = mkref(RICON, boolcon);
+ val = mkref(RICON, boolcon);
}
}
- vpush(&phis->ref, r);
+ vpush(&phis->ref, val);
if (next && next != end) {
putcondbranch(fn, r, next, end);
} else {