From b056b617f07c9b3c92e1b441bf9925837ec704f1 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Wed, 14 Oct 2026 12:08:28 +0100 Subject: [PATCH] chooseRegs: an end with no begin before it no longer indexes before the stack (found by the fuzz on a new test) --- diff --git a/src/Parse.raz b/src/Parse.raz index 8aa47bf..a2f5c1e 100644 --- a/src/Parse.raz +++ b/src/Parse.raz @@ -2500,8 +2500,12 @@ if isLoop[d] then INC(loops); end; end; | sEnd, sUntil: - if isLoop[d] then DEC(loops); end; - DEC(d); + (* an end with no begin before it, in a body the parser will + report, leaves d at 0 *) + if d > 0 then + if isLoop[d] then DEC(loops); end; + DEC(d); + end; | sIdent: if Scan.id = nameAdr then Scan.next;