[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Off-by-one when clearing stack slot after restart of a goto scope
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 1 Mar 2016 16:47:06 -0300
> Not sure if this was reported.
> This one was found via LuaJITs regression tests ported to Lua [1]:
>
> do
> local k = 0
> local x
> ::foo::
> local y
> assert(not y)
> y = true
> k = k + 1
> if k < 2 then goto foo end
> end
>
> [...]
Many thanks for the report. I guess the following patch fixes the
problem.
--- lparser.c 2016/01/05 16:22:37 2.151
+++ lparser.c 2016/03/01 19:44:17
@@ -1230,7 +1230,7 @@
checkrepeated(fs, ll, label); /* check for repeated labels */
checknext(ls, TK_DBCOLON); /* skip double colon */
/* create new entry for this label */
- l = newlabelentry(ls, ll, label, line, fs->pc);
+ l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs));
skipnoopstat(ls); /* skip other no-op statements */
if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
/* assume that locals are already out of scope */
-- Roberto