lua-users home
lua-l archive

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


KHMan <keinhong@gmail.com> wrote:

> Hi all,
> 
> -- print biggest 8 integers on Lua 5.3.4 for i =
> 0x7FFFFFFFFFFFFFF8,0x7FFFFFFFFFFFFFFF do print(i) end
> 
> All of you got 8 numbers? Yeah, I'm sure Lua 5.3.4 works fine. Nothing to
> see here.
> 
> -- Cheers, Kein-Hong Man (esq.) Selangor, Malaysia

The issue appears to be at line 1193 in lvm.c where 'idx' becomes negative:


lua_Integer idx = intop(+, ivalue(ra), step); /* 'idx' becomes negative! */


Which then fails the following 'if' logic check entering into a considerably
larger for-loop than expected:


if ((0 < step) ? (idx <= limit) : (limit <= idx)) {
/* 'idx' is now negative and so 'idx <= limit' is true */


As there are two loop variables, one internal and one external, I'd imagine
one solution to this issue would be to make the internal loop counter work
on an unsigned integer (just counting repetitions essentially) while
updating the external variable as expected.

I would make a patch but I am literally heading out the door for a Dr appt,
maybe when I get home I will try implementing my idea!

Not sure why your bug report came across so sarcastically though?

~Paige