scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 4ec218b3c3bd1ee6738597225494dd0c2da7001c
parent bb1cd7c8595651dabecee45fcad96d6d7f579de5
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 14 Jan 2017 18:43:00 +0100

[cc1] fix continue statement within while loop

Diffstat:
Mcc1/stmt.c | 17++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -69,24 +69,27 @@ condition(void) 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