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 <[email protected]> - 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)

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to