From: Weixie Cui <
cuiw...@gmail.com>
'floatforloop' uses 'L' in 'luai_numadd(L, idx, step)' but does
not receive it as a parameter. It compiles only because the default
'luai_numadd' macro ignores 'L'; custom redefinitions would break.
The sibling function 'forprep' correctly takes 'lua_State *L'.
---
lvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lvm.c b/lvm.c
index c70e2b8a..612369cb 100644
--- a/lvm.c
+++ b/lvm.c
@@ -270,7 +270,7 @@ static int forprep (lua_State *L, StkId ra) {
** true iff the loop must continue. (The integer case is
** written online with opcode OP_FORLOOP, for performance.)
*/
-static int floatforloop (StkId ra) {
+static int floatforloop (lua_State *L, StkId ra) {
lua_Number step = fltvalue(s2v(ra + 1));
lua_Number limit = fltvalue(s2v(ra));
lua_Number idx = fltvalue(s2v(ra + 2)); /* control variable */
@@ -1841,7 +1841,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
pc -= GETARG_Bx(i); /* jump back */
}
}
- else if (floatforloop(ra)) /* float loop */
+ else if (floatforloop(L, ra)) /* float loop */
pc -= GETARG_Bx(i); /* jump back */
updatetrap(ci); /* allows a signal to break the loop */
vmbreak;
--
2.39.5 (Apple Git-154)