lua-users home
lua-l archive

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


On Wed, Jun 22, 2016 at 12:33 AM, Daurnimator <quae@daurnimator.com> wrote:
> On 21 June 2016 at 15:17, Daurnimator <quae@daurnimator.com> wrote:
>> On 21 June 2016 at 14:06, Sergey Zakharchenko <doublef.mobile@gmail.com> wrote:
>>> Off the top of my head, there's something in your environment (gcc and
>>> clang runtime?) that's configuring the FPU to raise exceptions instead
>>> of return NaNs (via fesetexceptflag()?). Check with fegetexceptflag().
>>
>> As my post says, I see this output because I turned on the various
>> sanitizers when compiling (which are designed to help you find where
>> your code invokes undefined behaviour).
>>
>> In C, dividing a double by zero is undefined. From C89 draft standard
>> http://port70.net/~nsz/c/c89/c89-draft.html#3.3.5:
>>> The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.
>>
>> C99 has much the same to say: http://port70.net/~nsz/c/c99/n1256.html#6.5.5p5
>
> I brought this up with dalias (author of musl) and he says this
> section gets overridden by annex F.
> clang's ubsan confusingly turns on -fsanitize=float-divide-by-zero
>
> So, looks like this whole thing is a non-issue.
>

I have disabled this check in the sanitizer with the following options:

-fsanitize=undefined -fno-sanitize=float-divide-by-zero

-- 


Best regards,
Boris Nagaev