https://bugs.llvm.org/show_bug.cgi?id=43907
Bug ID: 43907
Summary: Double Signaling NaN converted to float becomes INF
Product: new-bugs
Version: 9.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
The following piece of code produce incorrect result with clang (and clang-cl)
on Windows:
```
#include <cmath>
#include <limits>
int main() {
const double quiet_nan_double = std::numeric_limits<double>::quiet_NaN();
const float converted_to_float = float(quiet_nan_double);
const bool isnan = std::isnan(converted_to_float);
return isnan ? 1 : 0;
}
```
The program should return 1. It does on Linux with majors compilers. On Windows
clang (and clang-cl) returns 0 no matter what compilation flags I tried. Here
are some flags I used:
clang -O3 -Wall -Wextra -g nan_d2f.cpp
clang -O0 -Wall -Wextra -g nan_d2f.cpp
clang -Wall -Wextra -g nan_d2f.cpp
clang-cl /Ox /W4 /EHsc nan_d2f.cpp
clang-cl /W4 /EHsc nan_d2f.cpp
Here is version reported by `clang -v`:
```
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\scoop\apps\llvm\current\bin
```
It was downloaded from here:
https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe#/dl.7z
Let me know if you need more info or cannot reproduce.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs