diff options
author | Ziang Wan <ziangw2@illinois.edu> | 2019-08-01 00:16:43 +0000 |
---|---|---|
committer | Ziang Wan <ziangw2@illinois.edu> | 2019-08-01 00:16:43 +0000 |
commit | 87b668befe19d47dd14919b2f322a81f1478e49d (patch) | |
tree | f9931482012c959d866e42a7972bd23b7e7be852 /clang/test/Sema/ext_vector_casts.c | |
parent | 153f20057c2f17d48c4feb08514811e61a86d0a8 (diff) | |
download | bcm5719-llvm-87b668befe19d47dd14919b2f322a81f1478e49d.tar.gz bcm5719-llvm-87b668befe19d47dd14919b2f322a81f1478e49d.zip |
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss
Issue an warning when the code tries to do an implicit int -> float
conversion, where the float type ha a narrower significant than the
float type.
The new warning is controlled by flag -Wimplicit-int-float-conversion,
under -Wimplicit-float-conversion and -Wconversion. It is also silenced
when c++11 narrowing warning is issued.
Differential Revision: https://reviews.llvm.org/D64666
llvm-svn: 367497
Diffstat (limited to 'clang/test/Sema/ext_vector_casts.c')
-rw-r--r-- | clang/test/Sema/ext_vector_casts.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/Sema/ext_vector_casts.c b/clang/test/Sema/ext_vector_casts.c index 6aaedbe7fd1..b13f8368348 100644 --- a/clang/test/Sema/ext_vector_casts.c +++ b/clang/test/Sema/ext_vector_casts.c @@ -115,12 +115,12 @@ static void splats(int i, long l, __uint128_t t, float f, double d) { vl = vl + t; // expected-warning {{implicit conversion loses integer precision}} vf = 1 + vf; - vf = l + vf; + vf = l + vf; // expected-warning {{implicit conversion from 'long' to 'float2' (vector of 2 'float' values) may lose precision}} vf = 2.0 + vf; vf = d + vf; // expected-warning {{implicit conversion loses floating-point precision}} - vf = vf + 0xffffffff; + vf = vf + 0xffffffff; // expected-warning {{implicit conversion from 'unsigned int' to 'float2' (vector of 2 'float' values) changes value from 4294967295 to 4294967296}} vf = vf + 2.1; // expected-warning {{implicit conversion loses floating-point precision}} - - vd = l + vd; - vd = vd + t; + + vd = l + vd; // expected-warning {{implicit conversion from 'long' to 'double2' (vector of 2 'double' values) may lose precision}} + vd = vd + t; // expected-warning {{implicit conversion from '__uint128_t' (aka 'unsigned __int128') to 'double2' (vector of 2 'double' values) may lose precision}} } |