lua-users home
lua-l archive

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


> To further emphasize your point: since subtracting unrelated pointers
> is Undefined Behavior, even on such a hypothetical architecture,
> compilers would still be allowed to perform this optimization. The
> comment that "the subsequent checks are ISO C and ensure a correct
> result" is wrong. If isinstack is ever called where o and base are
> unrelated, the entire execution is undefined.

You are right :-(

One option to fix that would be to traverse the whole segment looking
for a pointer equality: Slow but correct.  The size would be the number
of registers in a Lua function. This is limited to 255, but usually is
much smaller.

-- Roberto