[PATCH] D46535: Correct warning on Float->Integer conversions.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 7 09:59:20 PDT 2018


erichkeane created this revision.
erichkeane added reviewers: aaron.ballman, spatel, RKSimon.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D46535

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46535.145495.patch
Type: text/x-patch
Size: 6231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180507/8e7156b8/attachment.bin>


More information about the cfe-commits mailing list