lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thursday 08, Roberto Ierusalimschy wrote:
> > !             /* check that it does not jump to a setlist count; this
> > !                is tricky, because the count from a previous setlist may
> > !                have the same value of an invalid setlist; so, we must
> > !                go all the way back to the first of them (if any) */
> > !             for (j = 0; j < dest; j++) {
> > !               Instruction d = pt->code[dest-1];
> > !               if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0))
> > break; !             }
> >
> > Either I'm not looking at it right, or the for-loop body doesn't
> > reference the j variable
>
> Sorry about that. It should be
>
>  !               Instruction d = pt->code[dest-1-j];
>
> (It is tricky to create a test to exercise this case.)
>
> -- Roberto

Looks like patch 7 on the http://www.lua.org/bugs.html page has the j variable 
in the wrong place.

snip from patch 7
-            Instruction d = pt->code[dest-1-j];

+              Instruction d = pt->code[dest-1];

snip from full 'patch-lua-5.1.3'
-            Instruction d = pt->code[dest-1];

+              Instruction d = pt->code[dest-1-j];


-- 
Robert G. Jakabosky