From 0dd2b051236ff1d286c0e4368862ce4f3fd3880c Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 2 Oct 2021 18:07:16 -0700 Subject: 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. --- qbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qbe.c') 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); -- cgit v1.2.3