summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2017-03-08 22:16:43 +0100
committerMike Pall <mike>2017-03-08 22:16:43 +0100
commitff648369aa1f028750afa517ac095577ed8278d1 (patch)
treefbcee67cd4dec5f40f573e596efaa9ca23ced9a6
parent3ab9f5a18da06b06ebf1e4487997c25e32210dfe (diff)
downloadluajit2-ff648369aa1f028750afa517ac095577ed8278d1.tar.gz
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.c10
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)
MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc);
ls->vtop = idx; /* Drop break label immediately. */
gola_resolve(ls, bl, idx);
+ } else { /* Need the fixup step to propagate the breaks. */
+ gola_fixup(ls, bl);
return;
- } /* else: need the fixup step to propagate the breaks. */
- } else if (!(bl->flags & FSCOPE_GOLA)) {
- return;
+ }
+ }
+ if ((bl->flags & FSCOPE_GOLA)) {
+ gola_fixup(ls, bl);
}
- gola_fixup(ls, bl);
}
/* Mark scope as having an upvalue. */