http://llvm.org/bugs/show_bug.cgi?id=17686
Bug ID: 17686
Summary: static_casting a large unsigned long long to a double
causes an FPE
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 11422
--> http://llvm.org/bugs/attachment.cgi?id=11422&action=edit
Sample code that causes an unexpected FPE
I am getting an FPE when converting a double to an unsigned long long, if the
double is larger than the max (signed) long long. It is as if the static_cast
code is using the signed integer internally, for the conversion from a double
to the int type, then preforms a second conversion from the signed to unsigned.
double x = 9.223372036854776e+18;
unsigned long long ullX = static_cast<unsigned long long>(x);
I've attached a full example that shows the problem when running clang-3.3 on
Linux. The code works various versions of gcc that I tried.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs