diff options
| -rw-r--r-- | bugs | 33 | ||||
| -rw-r--r-- | lparser.c | 4 |
2 files changed, 35 insertions, 2 deletions
| @@ -3542,6 +3542,39 @@ patch = [[ | |||
| 3542 | } | 3542 | } |
| 3543 | 3543 | ||
| 3544 | 3544 | ||
| 3545 | Bug{ | ||
| 3546 | what = [[label between local definitions can mix-up their initializations]], | ||
| 3547 | report = [[Karel Tuma, 2016/03/01]], | ||
| 3548 | since = [[5.2]], | ||
| 3549 | fix = nil, | ||
| 3550 | example = [[ | ||
| 3551 | do | ||
| 3552 | local k = 0 | ||
| 3553 | local x | ||
| 3554 | ::foo:: | ||
| 3555 | local y -- should be reset to nil after goto, but it is not | ||
| 3556 | assert(not y) | ||
| 3557 | y = true | ||
| 3558 | k = k + 1 | ||
| 3559 | if k < 2 then goto foo end | ||
| 3560 | end | ||
| 3561 | ]], | ||
| 3562 | patch = [[ | ||
| 3563 | --- lparser.c 2015/11/02 16:09:30 2.149 | ||
| 3564 | +++ lparser.c 2016/03/03 12:03:37 | ||
| 3565 | @@ -1226,7 +1226,7 @@ | ||
| 3566 | checkrepeated(fs, ll, label); /* check for repeated labels */ | ||
| 3567 | checknext(ls, TK_DBCOLON); /* skip double colon */ | ||
| 3568 | /* create new entry for this label */ | ||
| 3569 | - l = newlabelentry(ls, ll, label, line, fs->pc); | ||
| 3570 | + l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); | ||
| 3571 | skipnoopstat(ls); /* skip other no-op statements */ | ||
| 3572 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ | ||
| 3573 | /* assume that locals are already out of scope */ | ||
| 3574 | ]] | ||
| 3575 | } | ||
| 3576 | |||
| 3577 | |||
| 3545 | --[=[ | 3578 | --[=[ |
| 3546 | Bug{ | 3579 | Bug{ |
| 3547 | what = [[ ]], | 3580 | what = [[ ]], |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.150 2015/12/09 15:21:28 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.151 2016/01/05 16:22:37 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -1230,7 +1230,7 @@ static void labelstat (LexState *ls, TString *label, int line) { | |||
| 1230 | checkrepeated(fs, ll, label); /* check for repeated labels */ | 1230 | checkrepeated(fs, ll, label); /* check for repeated labels */ |
| 1231 | checknext(ls, TK_DBCOLON); /* skip double colon */ | 1231 | checknext(ls, TK_DBCOLON); /* skip double colon */ |
| 1232 | /* create new entry for this label */ | 1232 | /* create new entry for this label */ |
| 1233 | l = newlabelentry(ls, ll, label, line, fs->pc); | 1233 | l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs)); |
| 1234 | skipnoopstat(ls); /* skip other no-op statements */ | 1234 | skipnoopstat(ls); /* skip other no-op statements */ |
| 1235 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ | 1235 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ |
| 1236 | /* assume that locals are already out of scope */ | 1236 | /* assume that locals are already out of scope */ |
