ref: 137133eba02f76bebcb8548ff125f931eebb3270
parent: c40315cac014ee7c319f6b7074f78e66af442126
author: Quentin Rameau <[email protected]>
date: Sat Jan 14 13:43:00 EST 2017
[cc1] fix continue statement within while loop
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -69,24 +69,27 @@
static void
While(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
{
- Symbol *begin, *cond, *end;
+ Symbol *begin;
Node *np;
begin = newlabel();
- end = newlabel();
- cond = newlabel();
+ lcont = newlabel();
+ lbreak = newlabel();
expect(WHILE);
np = condition();
- emit(OJUMP, cond);
+
+ emit(OJUMP, lcont);
+
emit(OBLOOP, NULL);
emit(OLABEL, begin);
- stmt(end, begin, lswitch);
- emit(OLABEL, cond);
+ stmt(lbreak, lcont, lswitch);
+ emit(OLABEL, lcont);
emit(OBRANCH, begin);
emit(OEXPR, np);
emit(OELOOP, NULL);
- emit(OLABEL, end);
+
+ emit(OLABEL, lbreak);
}
static void