[llvm-bugs] [Bug 42496] New: NaN compares equal for SPARC V9
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 3 07:01:12 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42496
Bug ID: 42496
Summary: NaN compares equal for SPARC V9
Product: libraries
Version: trunk
Hardware: Sun
OS: Solaris
Status: NEW
Keywords: miscompilation
Severity: enhancement
Priority: P
Component: Backend: Sparc
Assignee: unassignedbugs at nondot.org
Reporter: ro at gcc.gnu.org
CC: llvm-bugs at lists.llvm.org, venkatra at cs.wisc.edu
When investigating the last test failures on SPARC (for
https://reviews.llvm.org/D40900),
I found two failures that boil down to long double NaN comparing equal to
itself
on 64-bit SPARC:
Builtins-sparcv9-sunos :: compiler_rt_logbl_test.c
Builtins-sparcv9-sunos :: divtc3_test.c
They seem to boil down to the following testcase:
$ cat nancmp.c
#include <math.h>
#include <stdio.h>
int
main (void)
{
long double lnan = NAN;
long double mlnan = -NAN;
if (lnan != lnan)
printf ("nan neq\n");
else
printf ("nan eq\n");
if (mlnan != mlnan)
printf ("-nan neq\n");
else
printf ("-nan eq\n");
return 0;
}
$ gcc -m32 -o nancmp nancmp.c && ./nancmp
nan neq
-nan neq
gcc -m64 -o nancmp nancmp.c && ./nancmp
nan neq
-nan neq
$ clang -m32 -o nancmp nancmp.c && ./nancmp
nan neq
-nan neq
$ clang -m64 -o nancmp nancmp.c && ./nancmp
nan eq
-nan eq
This may be due to the fact that clang calls _Qp_cmp for the comparison, which
returns unordered (3) in this case, while gcc uses _Qp_feq, which just returns
unequal (0) instead.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190703/8d41f6d8/attachment.html>
More information about the llvm-bugs
mailing list