[PATCH] D64666: [Sema] Enable -Wimplicit-int-float-conversion for integral to floating point precision loss

Ziang Wan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 14:36:15 PDT 2019


ziangwan added a comment.

The two failing cases I am seeing are:

  /home/motus/netbsd8/netbsd8/llvm/projects/libcxx/include/random:3648:40: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
      const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1);

  /data/motus/netbsd8/netbsd8/llvm/projects/libcxx/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp:27:64: error: implicit conversion from 'unsigned int' to 'float' changes value from 2147483645 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
          assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));

These are the intended behavior of this warning.

I will make a separate patch to fix the two failing cases.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64666/new/

https://reviews.llvm.org/D64666





More information about the llvm-commits mailing list