diff options
| author | Mike Pall <mike> | 2017-03-08 22:16:43 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2017-03-08 22:16:43 +0100 |
| commit | ff648369aa1f028750afa517ac095577ed8278d1 (patch) | |
| tree | fbcee67cd4dec5f40f573e596efaa9ca23ced9a6 | |
| parent | 3ab9f5a18da06b06ebf1e4487997c25e32210dfe (diff) | |
| download | luajit-ff648369aa1f028750afa517ac095577ed8278d1.tar.gz luajit-ff648369aa1f028750afa517ac095577ed8278d1.tar.bz2 luajit-ff648369aa1f028750afa517ac095577ed8278d1.zip | |
Fix out-of-scope goto handling in parser.
Many thanks to Demetrios Obenour for tracking down this long-standing bug.
| -rw-r--r-- | src/lj_parse.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_parse.c b/src/lj_parse.c index 26300ab5..9e5976f7 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c | |||
| @@ -1280,12 +1280,14 @@ static void fscope_end(FuncState *fs) | |||
| 1280 | MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc); | 1280 | MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc); |
| 1281 | ls->vtop = idx; /* Drop break label immediately. */ | 1281 | ls->vtop = idx; /* Drop break label immediately. */ |
| 1282 | gola_resolve(ls, bl, idx); | 1282 | gola_resolve(ls, bl, idx); |
| 1283 | } else { /* Need the fixup step to propagate the breaks. */ | ||
| 1284 | gola_fixup(ls, bl); | ||
| 1283 | return; | 1285 | return; |
| 1284 | } /* else: need the fixup step to propagate the breaks. */ | 1286 | } |
| 1285 | } else if (!(bl->flags & FSCOPE_GOLA)) { | 1287 | } |
| 1286 | return; | 1288 | if ((bl->flags & FSCOPE_GOLA)) { |
| 1289 | gola_fixup(ls, bl); | ||
| 1287 | } | 1290 | } |
| 1288 | gola_fixup(ls, bl); | ||
| 1289 | } | 1291 | } |
| 1290 | 1292 | ||
| 1291 | /* Mark scope as having an upvalue. */ | 1293 | /* Mark scope as having an upvalue. */ |
