[hackers] [scc] [cc1] fix continue statement within for loop || Quentin Rameau
commit bb1cd7c8595651dabecee45fcad96d6d7f579de5
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sat Jan 14 18:35:16 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Sat Jan 14 18:35:16 2017 +0100
[cc1] fix continue statement within for loop
diff --git a/cc1/stmt.c b/cc1/stmt.c
index 95a65e1..5b59e75 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -92,12 +92,13 @@ While(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
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('(');
_AT_@ -110,15 +111,18 @@ For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
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
Received on Sat Jan 14 2017 - 20:34:26 CET
This archive was generated by hypermail 2.3.0
: Sat Jan 14 2017 - 20:36:19 CET