aboutsummaryrefslogtreecommitdiff
path: root/stmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmt.c')
-rw-r--r--stmt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/stmt.c b/stmt.c
index f7dd0cd..cf5209d 100644
--- a/stmt.c
+++ b/stmt.c
@@ -153,7 +153,7 @@ stmt(struct func *f, struct scope *s)
next();
s = mkscope(s);
expect(TLPAREN, "after 'while'");
- e = expr(s);
+ e = exprconvert(expr(s), &typebool);
expect(TRPAREN, "after expression");
label[0] = mkblock("while_cond");
@@ -191,7 +191,7 @@ stmt(struct func *f, struct scope *s)
expect(TWHILE, "after 'do' statement");
expect(TLPAREN, "after 'while'");
funclabel(f, label[1]);
- e = expr(s);
+ e = exprconvert(expr(s), &typebool);
expect(TRPAREN, "after expression");
v = funcexpr(f, e);
@@ -226,7 +226,7 @@ stmt(struct func *f, struct scope *s)
delexpr(e);
}
expect(TSEMICOLON, NULL);
- e = tok.kind == TRPAREN ? NULL : expr(s);
+ e = tok.kind == TRPAREN ? NULL : exprconvert(expr(s), &typebool);
expect(TRPAREN, NULL);
funclabel(f, label[1]);