efriedma added a comment.
> Every Integer is representable (lossy of course) as a float as far as I know.
Casting a __uint128_t to float can overflow. And overflowing a _Float16 is
easy. (Of course, both __uint128_t and _Float16 are rare in normal C/C++ code.)
Repository:
rC Clang
https:/
xbolva00 added a comment.
Yeah, I want to check if it fits into mantissa.
Repository:
rC Clang
https://reviews.llvm.org/D46535
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
erichkeane added a comment.
In https://reviews.llvm.org/D46535#1253473, @xbolva00 wrote:
> Hello, @erichkeane
>
> I am working on int to float checker but I haven't found yet a way how to
> check if integer fits to float's significant bits. Maybe you can recommend me
> something? I already trie
xbolva00 added a comment.
Hello, @erichkeane
I am working on int to float checker but I haven't found yet a way how to check
if integer fits to float's significant bits. Maybe you can recommend me
something? I already tried some LLVM APIs but no success. (cc @spatel as you
will probably know t
erichkeane added a comment.
In https://reviews.llvm.org/D46535#1091787, @efriedma wrote:
> The check for whether an input is "out of range" doesn't handle fractions
> correctly. Testcase:
>
> int a() { return 2147483647.5; }
> unsigned b() { return -.5; }
>
Hrm... For some reaosn I had it
efriedma added a comment.
The check for whether an input is "out of range" doesn't handle fractions
correctly. Testcase:
int a() { return 2147483647.5; }
unsigned b() { return -.5; }
Repository:
rC Clang
https://reviews.llvm.org/D46535
___
This revision was automatically updated to reflect the committed changes.
Closed by commit rC331673: Correct warning on Float->Integer conversions.
(authored by erichkeane, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D46535?vs=145536&id=145542#toc
Repository:
rC Clang
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
https://reviews.llvm.org/D46535
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman
erichkeane updated this revision to Diff 145536.
erichkeane marked an inline comment as done.
erichkeane added a comment.
Aaron's comments :)
https://reviews.llvm.org/D46535
Files:
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
test/SemaCXX/coroutines.cpp
test/Sema
erichkeane marked 2 inline comments as done.
erichkeane added inline comments.
Comment at: lib/Sema/SemaChecking.cpp:9440-9441
+diag::warn_impcast_literal_float_to_integer_out_of_range);
+ if (IntegerValue.isUnsigned() &&
+ (IntegerValue.isMaxValue() ||
aaron.ballman added inline comments.
Comment at: lib/Sema/SemaChecking.cpp:9432
if (IsLiteral) {
+// Conversion of a floating point value to a non-bool integer where the
+// integral part cannot be represented by the integer type is undefined.
floating
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
12 matches
Mail list logo