]> granicus.if.org Git - clang/commit
Correct warning on Float->Integer conversions.
authorErich Keane <erich.keane@intel.com>
Mon, 7 May 2018 20:52:56 +0000 (20:52 +0000)
committerErich Keane <erich.keane@intel.com>
Mon, 7 May 2018 20:52:56 +0000 (20:52 +0000)
commit8052cdc6396773b874b2b1d54c6c4f52445d2b72
treeb59df3193bc10ef0a40327d8f971cd08713a10ac
parentffe5542eab6ccd9b09e1a4a951993e230d4f88a4
Correct warning on Float->Integer conversions.

As identified and briefly discussed here:
https://bugs.llvm.org/show_bug.cgi?id=37305

Converting a floating point number to an integer type when
the integral part is out of the range of the integer type is
undefined behavior in C. Additionally, CodeGen emits an undef
in this situation.

HOWEVER, we've been giving a warning that says that the value is
changed. This patch corrects the warning to list that it is actually
undefined behavior.

Differential Revision: https://reviews.llvm.org/D46535

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331673 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
test/SemaCXX/coroutines.cpp
test/SemaCXX/warn-float-conversion.cpp
test/SemaCXX/warn-literal-conversion.cpp