raz / commit b056b617

commit
b056b617f07c9b3c92e1b441bf9925837ec704f1
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
b38de572
chooseRegs: an end with no begin before it no longer indexes before the stack (found by the fuzz on a new test)

patch · log

1 file changed, +6 -2

src/Parse.raz (history) modified +6 -2

@@ -2500,8 +2500,12 @@
25002500 if isLoop[d] then INC(loops); end;
25012501 end;
25022502 | sEnd, sUntil:
2503- if isLoop[d] then DEC(loops); end;
2504- DEC(d);
2503+ (* an end with no begin before it, in a body the parser will
2504+ report, leaves d at 0 *)
2505+ if d > 0 then
2506+ if isLoop[d] then DEC(loops); end;
2507+ DEC(d);
2508+ end;
25052509 | sIdent:
25062510 if Scan.id = nameAdr then
25072511 Scan.next;