diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-06-23 20:24:53 +0000 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-06-23 20:24:53 +0000 |
commit | 4a39e80809f6160fbf95e4a6cbc4161346db50a6 (patch) | |
tree | 7bcb568465cf6e40d8eccb41abd38428b0bc4696 /clang/lib/Driver/Tools.cpp | |
parent | 2aec6216cb8d61bd5e7a22234e40be8780e2414d (diff) | |
download | bcm5719-llvm-4a39e80809f6160fbf95e4a6cbc4161346db50a6.tar.gz bcm5719-llvm-4a39e80809f6160fbf95e4a6cbc4161346db50a6.zip |
Fix incorrect truncation at the overflow boundary
Summary:
This patch fixes incorrect truncation when the input wider value is
exactly 2^dstBits. For that value, the overflow to infinity is not
correctly handled. The fix is to replace a strict '>' with '>='.
Currently,
__truncdfsf2(340282366900000000000000000000000000000.0) returns infinity
__truncdfsf2(340282366920938463463374607431768211456.0) returns 0
__truncdfsf2(400000000000000000000000000000000000000.0) returns infinity
Likewise, __truncdfhf2 and __truncsfhf2 (and consequently gnu_f2h_ieee)
are discontinuous at 65536.0.
This patch adds tests for all three cases, along with adding a missing
header include to fp_test.h.
Reviewers: joerg, ab, srhines
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10594
llvm-svn: 240450
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
0 files changed, 0 insertions, 0 deletions