[llvm-bugs] [Bug 24599] New: clang++ cannot cast double to unsigned correctly.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 27 11:21:55 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24599
Bug ID: 24599
Summary: clang++ cannot cast double to unsigned correctly.
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jtony at ca.ibm.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Clang cast double to unsigned wrongly, while g++ can cast it correctly.
-------------------------------------------------------------------------
-bash-4.2$ cat test.C
#include <iostream>
using namespace std;
int main(){
double d1 = 10.0L;
cout << "d1:"<<d1<<" unsigned:"<< static_cast<unsigned>(d1) << endl;
}
-------------------------------------------------------------------------
g++ test result:
-------------------------------------------------------------------------
-bash-4.2$ g++ test.C
-bash-4.2$ ./a.out
d1:10 unsigned:10
-------------------------------------------------------------------------
clang++ test result:
-------------------------------------------------------------------------
-bash-4.2$ clang++ test.C
-bash-4.2$ ./a.out
d1:10 unsigned:0
-------------------------------------------------------------------------
The above test is done on Red Hat Enterprise Linux Server release 7.1 Beta
(Maipo). This problem exists in both clang++ 3.5 and clang++ 3.6.
--
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/20150827/af3497e0/attachment.html>
More information about the llvm-bugs
mailing list