diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-08-07 16:04:06 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-08-07 16:04:06 -0300 |
| commit | ca7e5b5cb62246653647753f5a6e7fa85e8f030d (patch) | |
| tree | cbf652660c45c0bff4a5ca7d20c6cb92ccc34067 /bugs | |
| parent | 5019b2dd205751c6f29c4ced2b6f1e22c096fb83 (diff) | |
| download | lua-ca7e5b5cb62246653647753f5a6e7fa85e8f030d.tar.gz lua-ca7e5b5cb62246653647753f5a6e7fa85e8f030d.tar.bz2 lua-ca7e5b5cb62246653647753f5a6e7fa85e8f030d.zip | |
wrong message error in some cases involving closures
Diffstat (limited to 'bugs')
| -rw-r--r-- | bugs | 43 |
1 files changed, 43 insertions, 0 deletions
| @@ -1052,3 +1052,46 @@ patch = [[ | |||
| 1052 | ]], | 1052 | ]], |
| 1053 | 1053 | ||
| 1054 | } | 1054 | } |
| 1055 | |||
| 1056 | |||
| 1057 | Bug{ | ||
| 1058 | what = [[wrong message error in some cases involving closures]], | ||
| 1059 | |||
| 1060 | report = [[Shmuel Zeigerman, on 07/2006]], | ||
| 1061 | |||
| 1062 | since = "Lua 5.1", | ||
| 1063 | |||
| 1064 | example = [[ | ||
| 1065 | local Var | ||
| 1066 | local function main() | ||
| 1067 | NoSuchName (function() Var=0 end) | ||
| 1068 | end | ||
| 1069 | main() | ||
| 1070 | --> lua5.1: temp:3: attempt to call upvalue 'Var' (a nil value) | ||
| 1071 | ]], | ||
| 1072 | |||
| 1073 | patch = [[ | ||
| 1074 | *ldebug.c: | ||
| 1075 | @@ -435,14 +435,16 @@ | ||
| 1076 | break; | ||
| 1077 | } | ||
| 1078 | case OP_CLOSURE: { | ||
| 1079 | - int nup; | ||
| 1080 | + int nup, j; | ||
| 1081 | check(b < pt->sizep); | ||
| 1082 | nup = pt->p[b]->nups; | ||
| 1083 | check(pc + nup < pt->sizecode); | ||
| 1084 | - for (; nup>0; nup--) { | ||
| 1085 | - OpCode op1 = GET_OPCODE(pt->code[pc+nup]); | ||
| 1086 | + for (j = 1; j <= nup; j++) { | ||
| 1087 | + OpCode op1 = GET_OPCODE(pt->code[pc + j]); | ||
| 1088 | check(op1 == OP_GETUPVAL || op1 == OP_MOVE); | ||
| 1089 | } | ||
| 1090 | + if (reg != NO_REG) /* tracing? */ | ||
| 1091 | + pc += nup; /* do not 'execute' these pseudo-instructions */ | ||
| 1092 | break; | ||
| 1093 | } | ||
| 1094 | case OP_VARARG: { | ||
| 1095 | ]], | ||
| 1096 | |||
| 1097 | } | ||
