[PATCH] D64666: Allow Clang -Wconversion, -Wimplicit-float-conversion warns about integer type -> floating point type implicit conversion precision loss.
Ziang Wan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 12 14:41:51 PDT 2019
ziangwan added a comment.
In D64666#1583633 <https://reviews.llvm.org/D64666#1583633>, @xbolva00 wrote:
> You can check also https://reviews.llvm.org/D52835. I hit there issue which I didn't know how to solve.
Hi David,
I have read your patch. I think that integer-to-floating-point conversion does not necessarily leads to precision loss. We need to have extra condition about whether to issue warnings.
For example,
1. Convert 222222222222L to float leads to precision loss. The reason is that 222222222222L needs 48 bits of precision where float only has 24 bits of precision.
2. Convert 222222 to float does not lead to precision loss. 222222 needs 18 bits of precision only.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64666/new/
https://reviews.llvm.org/D64666
More information about the cfe-commits
mailing list