[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [PATCH] Loop Overflow Bug Fix
- From: Paige DePol <lual@...>
- Date: Wed, 15 Nov 2017 14:35:24 -0600
dyngeccetor8 <email@example.com> wrote:
> On 11/15/2017 06:48 AM, Paige DePol wrote:
>> I have produced a very small patch which only makes adjustments in lvm.c to the OP_FORLOOP and OP_FORPREP opcodes to solve the issue of the edge case where math.maxinteger or math.mininteger are used, or where the sign bit overflowed.
> Well, your patch broke version detection test from KHMan.
> Now I can not reproduce cycle going out of limits:
>> for i = math.maxinteger, math.maxinteger do print(i) end
>> for i = math.maxinteger, math.maxinteger - 2, -1 do print(i) end
>> for i = math.mininteger, math.mininteger + 2, 1 do print(i) end
> (Thank you for patch.)
> -- Martin
Which feature detection test are you referring to? Lua features?
Couldn't one just use the normal _VERSION variable?
The examples you gave are now working as I'd expect they should be. I just
need to look into the corner cases my patch did not address (as mentioned
in reply by Roberto to my patch post).
However, even with the remaining corner cases I think the patch I provided
does seem to allow the previously "broken" loop constructs to now work with
appropriate step values around min/max integers, and loops iterating at
least once at min/max integer values.