lua-users home
lua-l archive

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


On 17 June 2016 at 14:20, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> static void freereg (FuncState *fs, int reg) {
>>   if (!ISK(reg) && reg >= fs->nactvar) {
>>     fs->freereg--;
>>     lua_assert(reg == fs->freereg);
>>   }
>> }
>>
>> The assertion failure occurs when compiling math.lua at line 551:
>>
>>  assert(1 % math.huge == 1)
>>
>
> That assertion is quite tricky. It ensures that registers are being
> allocated-deallocated in a stack discipline, and any optimization
> may disturb this fragile balance.
>

I ran the tests with the official Lua 5.3.3 distribution - they passed
fine. So the problem is related to my modifications and merge it
seems.

I noticed that in the function codebinexpval() in lcode.c the order in
which the luaK_exp2RK() is called has changed between 5.3.2 and 5.3.3.
So I tried the same tests again after reversing the order (i.e.
restoring the order used in 5.3.2) and curiously the tests now pass.

As far as I can tell the order should not matter as freeexps() checks
which register is greater. But somehow in my version it seems to make
a difference.

Regards
Dibyendu