aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaChecking.cpp9
-rw-r--r--test/Sema/conversion-64-32.c10
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 8dc54ae553..9c47e1e1e2 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/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/test/Sema/conversion-64-32.c b/test/Sema/conversion-64-32.c
index aa7282962f..112e995102 100644
--- a/test/Sema/conversion-64-32.c
+++ b/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;
+}