scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 976603250601c41b01e0c99788cbac58dc66d723
parent 4ec218b3c3bd1ee6738597225494dd0c2da7001c
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 14 Jan 2017 18:46:55 +0100

[cc1] fix continue statement within do loop

Diffstat:
Mcc1/stmt.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -131,21 +131,26 @@ For(Symbol *lbreak, Symbol *lcont, Switch *lswitch) static void Dowhile(Symbol *lbreak, Symbol *lcont, Switch *lswitch) { - Symbol *begin, *end; + Symbol *begin; Node *np; begin = newlabel(); - end = newlabel(); + lcont = newlabel(); + lbreak = newlabel(); + expect(DO); + emit(OBLOOP, NULL); emit(OLABEL, begin); - stmt(end, begin, lswitch); + stmt(lbreak, lcont, lswitch); expect(WHILE); np = condition(); + emit(OLABEL, lcont); emit(OBRANCH, begin); emit(OEXPR, np); emit(OELOOP, NULL); - emit(OLABEL, end); + + emit(OLABEL, lbreak); } static void