aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-10-02 18:07:16 -0700
committerMichael Forney <mforney@mforney.org>2021-10-02 18:07:16 -0700
commit0dd2b051236ff1d286c0e4368862ce4f3fd3880c (patch)
treefa64bf4091e223a7ffc4bf3c77d55be3f4fc8138 /qbe.c
parente36dc296f50cb2d60d3b27ce62217762b9655313 (diff)
qbe: Re-add conversion to bool RHS of logical and/or
7e838669 removed conversion to bool for int expressions used only to control jnz, but incorrectly dropped the conversion for the right-hand-side of logical and/or as well. We need the result of the expression to be 0 or 1, so we still need that conversion.
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qbe.c b/qbe.c
index 726d3b3..91bcf11 100644
--- a/qbe.c
+++ b/qbe.c
@@ -807,7 +807,7 @@ funcexpr(struct func *f, struct expr *e)
b[1]->phi.blk[0] = f->end;
funclabel(f, b[0]);
r = funcexpr(f, e->binary.r);
- b[1]->phi.val[1] = r;
+ b[1]->phi.val[1] = convert(f, &typebool, e->binary.r->type, r);
b[1]->phi.blk[1] = f->end;
funclabel(f, b[1]);
functemp(f, &b[1]->phi.res);