From ca7e5b5cb62246653647753f5a6e7fa85e8f030d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 7 Aug 2006 16:04:06 -0300 Subject: wrong message error in some cases involving closures --- bugs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'bugs') diff --git a/bugs b/bugs index c0eb3271..ad6d0f07 100644 --- a/bugs +++ b/bugs @@ -1052,3 +1052,46 @@ patch = [[ ]], } + + +Bug{ +what = [[wrong message error in some cases involving closures]], + +report = [[Shmuel Zeigerman, on 07/2006]], + +since = "Lua 5.1", + +example = [[ +local Var +local function main() + NoSuchName (function() Var=0 end) +end +main() +--> lua5.1: temp:3: attempt to call upvalue 'Var' (a nil value) +]], + +patch = [[ +*ldebug.c: +@@ -435,14 +435,16 @@ + break; + } + case OP_CLOSURE: { +- int nup; ++ int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); +- for (; nup>0; nup--) { +- OpCode op1 = GET_OPCODE(pt->code[pc+nup]); ++ for (j = 1; j <= nup; j++) { ++ OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } ++ if (reg != NO_REG) /* tracing? */ ++ pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { +]], + +} -- cgit v1.2.3-55-g6feb