diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-06-14 04:51:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-06-14 04:51:15 +0000 |
| commit | ee7286f02dcf6711a84f3e6908a6d1a6727d90da (patch) | |
| tree | 92e6833da7e8fa2c483b13eb1bf5b072f15e5544 | |
| parent | da24f2f8e175e3561e9a523fa5dd70a448a6b369 (diff) | |
| download | bcm5719-llvm-ee7286f02dcf6711a84f3e6908a6d1a6727d90da.tar.gz bcm5719-llvm-ee7286f02dcf6711a84f3e6908a6d1a6727d90da.zip | |
fix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.
llvm-svn: 132975
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 9 | ||||
| -rw-r--r-- | clang/test/Sema/conversion-64-32.c | 10 |
2 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 8dc54ae5531..9c47e1e1e26 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2895,6 +2895,11 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, return; return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_vector_scalar); } + + // If the vector cast is cast between two vectors of the same size, it is + // a bitcast, not a conversion. + if (S.Context.getTypeSize(Source) == S.Context.getTypeSize(Target)) + return; Source = cast<VectorType>(Source)->getElementType().getTypePtr(); Target = cast<VectorType>(Target)->getElementType().getTypePtr(); @@ -2989,9 +2994,7 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, return; } - // People want to build with -Wshorten-64-to-32 and not -Wconversion - // and by god we'll let them. - + // People want to build with -Wshorten-64-to-32 and not -Wconversion. if (isFromSystemMacro(S, CC)) return; diff --git a/clang/test/Sema/conversion-64-32.c b/clang/test/Sema/conversion-64-32.c index aa7282962f8..112e995102c 100644 --- a/clang/test/Sema/conversion-64-32.c +++ b/clang/test/Sema/conversion-64-32.c @@ -3,3 +3,13 @@ int test0(long v) { return v; // expected-warning {{implicit conversion loses integer precision}} } + + +// rdar://9546171 +typedef int int4 __attribute__ ((vector_size(16))); +typedef long long long2 __attribute__((__vector_size__(16))); + +int4 test1(long2 a) { + int4 v127 = a; // no warning. + return v127; +} |

