ref: c40315cac014ee7c319f6b7074f78e66af442126
parent: 1e29199cbbb7d19343dae9c89493b5a9cb40caf9
author: Quentin Rameau <[email protected]>
date: Sat Jan 14 13:35:16 EST 2017
[cc1] fix continue statement within for loop
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -92,12 +92,13 @@
static void
For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
{
- Symbol *begin, *cond, *end;
+ Symbol *begin, *cond;
Node *econd, *einc, *einit;
begin = newlabel();
- end = newlabel();
+ lcont = newlabel();
cond = newlabel();
+ lbreak = newlabel();
expect(FOR);
expect('(');
@@ -110,15 +111,18 @@
emit(OEXPR, einit);
emit(OJUMP, cond);
+
emit(OBLOOP, NULL);
emit(OLABEL, begin);
- stmt(end, begin, lswitch);
+ stmt(lbreak, lcont, lswitch);
+ emit(OLABEL, lcont);
emit(OEXPR, einc);
emit(OLABEL, cond);
emit((econd) ? OBRANCH : OJUMP, begin);
emit(OEXPR, econd);
emit(OELOOP, NULL);
- emit(OLABEL, end);
+
+ emit(OLABEL, lbreak);
}
static void