tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs


From: Vincent Lefevre
Subject: Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs
Date: Mon, 4 Jan 2021 03:05:36 +0100
User-agent: Mutt/2.0.4+66 (e4a8abe8) vl-132933 (2021-01-03)

On 2021-01-03 21:17:03 +0200, Arnold Robbins wrote:
> Hi.
> 
> I found this bug in current mob on the current gawk sources. Test case:
> 
> -----------------------------
> #include <stdio.h>
> #include <math.h>
> #include <stdlib.h>
> 
> int main(int argc, char **argv)
> {
>       double d = strtod("-nan", NULL);
>       d = -d;
>       printf("%g, signbit(d) = %d\n", d, signbit(d));
>       return 0;
> }
> -----------------------------
> 
> Results:
> 
>       $ gcc foo.c -o foo && ./foo
>       -nan, signbit(d) = 1
> 
>       $ tcc foo.c -o foo2 && ./foo2
>       nan, signbit(d) = 0
> 
> I get the same results as gcc with clang and pcc. tcc is the outlier.

AFAIK, the status of the sign bit of a NaN is unspecified, except
for some particular functions, but not strtod. So I don't see a
bug in tcc.

Note: for GCC, there's an inconsistency between your testcase
and the result.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]