shithub: scc

Download patch

ref: ffa04f840ae175eb5aef9c272b5d160028b83107
parent: 137133eba02f76bebcb8548ff125f931eebb3270
author: Quentin Rameau <quinq@fifth.space>
date: Sat Jan 14 13:46:55 EST 2017

[cc1] fix continue statement within do loop

--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -131,21 +131,26 @@
 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