diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-03-07 16:25:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2016-03-07 16:25:39 -0300 |
commit | e7b2e01d43d9c3ab6d223daa18eebb94a322e082 (patch) | |
tree | 0f6ba55c0b90037e47ef6ee061c1ec51e526d99a /bugs | |
parent | 03ca6385dc426fefabe9204037fc76ebf0627a11 (diff) | |
download | lua-e7b2e01d43d9c3ab6d223daa18eebb94a322e082.tar.gz lua-e7b2e01d43d9c3ab6d223daa18eebb94a322e082.tar.bz2 lua-e7b2e01d43d9c3ab6d223daa18eebb94a322e082.zip |
bug: label between local definitions can mix-up their initializations
Diffstat (limited to 'bugs')
-rw-r--r-- | bugs | 33 |
1 files changed, 33 insertions, 0 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 = [[ ]], |