From e6b7f1be2c05ebc34673d481a0a3758b32aae453 Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 3 May 2019 10:55:57 +0200 Subject: [PATCH] Always emit OP_JMPLFE as goto can be used inside a loop and frame has to be left. --- engine/compiler.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/compiler.c b/engine/compiler.c index 75d6e1b..f792306 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -1523,6 +1523,8 @@ static sxi32 PH7_CompileGoto(ph7_gen_state *pGen) } else { sJump.pFunc = 0; } + /* Make sure there will not stay any loop frame opened (i.e. goto inside a loop) */ + PH7_VmEmitInstr(pGen->pVm, sJump.nLine, PH7_OP_JMPLFE, 0, 0, 0, 0); /* Emit the unconditional jump */ if(SXRET_OK == PH7_VmEmitInstr(pGen->pVm, sJump.nLine, PH7_OP_JMP, 0, 0, 0, &sJump.nInstrIdx)) { SySetPut(&pGen->aGoto, (const void *)&sJump);