aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/c.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/c/c.c b/c/c.c
index d609cd0..6d1996a 100644
--- a/c/c.c
+++ b/c/c.c
@@ -3051,11 +3051,14 @@ condexprrec(struct function *fn, const struct expr *ex, struct condphis *phis,
condexprrec(fn, &ex->sub[2], phis, phityp, -1, end, end);
} else {
union ref r, val;
+ union type valty;
if (!phis && (!next || next == end)) {
expreffects(fn, ex);
} else {
val = r = exprvalue(fn, ex);
+ valty = ex->ty;
if (boolcon >= 0) {
+ valty = mktype(TYBOOL);
if (!next || next == end) {
boolcon = -1;
val = cvt(fn, mktype(TYBOOL), ex->ty, r);
@@ -3066,7 +3069,7 @@ condexprrec(struct function *fn, const struct expr *ex, struct condphis *phis,
}
if (phis) {
if (isscalar(phityp))
- val = cvt(fn, phityp, ex->ty, val);
+ val = cvt(fn, phityp, valty, val);
else assert(ex->ty.bits == phityp.bits);
vpush(&phis->ref, val);
}