scc

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

commit cf8e9e411ee41b2bdf227922c88038785319fc0c
parent 1770b6f83b89855a47d3457c2a1c24127d033d43
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 24 Apr 2014 09:15:03 +0200

Fix call to stmt in loops

The first parameter of stmt if the break label, so it must be end,
and not begin how the code was doing.

Diffstat:
Mstmt.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stmt.c b/stmt.c @@ -53,7 +53,7 @@ While(Symbol *lswitch) emitjump(cond, NULL); emitbloop(); emitlabel(begin); - stmt(begin, end, lswitch); + stmt(end, begin, lswitch); emitlabel(cond); emitjump(begin, np); emiteloop(); @@ -80,7 +80,7 @@ For(Symbol *lswitch) emitjump(cond, NULL); emitbloop(); emitlabel(begin); - stmt(begin, end, lswitch); + stmt(end, begin, lswitch); if (einc) emitexp(einc); emitlabel(cond); @@ -98,7 +98,7 @@ Dowhile(Symbol *lswitch) expect(DO); emitbloop(); emitlabel(begin); - stmt(begin, end, lswitch); + stmt(end, begin, lswitch); expect(WHILE); emitjump(begin, condition()); emiteloop();