lua-users home
lua-l archive

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


On 6 October 2015 at 12:39, Pat Brown <ptbrown@whoopdedo.org> wrote:
> On Monday, October 05, 2015 11:38:21 AM Daurnimator wrote:
>> Here are the errors I got running test suite:
>
> Isn't that the point? To test these edge cases that aren't well-defined?

No.
The lua tests are to ensure that lua performs correctly in odd
circumstances/corner cases.

What -fsantizer=undefined does is wrap situations where undefined
behaviour happens in *C*;
e.g. in C, what happens on non-signed integer overflow is undefined,
so it wraps all integer additions in a function that checks for
undefined behaviour and logs it.
Undefined behaviour means that the generated code may crash, it may
format your hard drive, it may cause demons to shoot out your nose...
However, in practice, what *usually* happens, is that operations just
wrap around to the lowest integer.
and infact thats what lua lines of code I referenced rely on.

These are bugs in the lua implementation just waiting to be uncovered
by a sufficiently smart C compiler (which may decide to e.g. clamp
instead of overflow, as it's simpler on some new processor).