summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-01-04 03:31:22 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-01-04 03:31:22 +0000
commiteb68f6a9de3c782e93321e48422b4ac2b4f9a6be (patch)
tree77ca69ef2e5202bab9120b7cbd4f4017de685192 /clang/test/Sema
parent658eb68e82e665132e15a96a85384974de20ceef (diff)
downloadbcm5719-llvm-eb68f6a9de3c782e93321e48422b4ac2b4f9a6be.tar.gz
bcm5719-llvm-eb68f6a9de3c782e93321e48422b4ac2b4f9a6be.zip
[Sema] When checking if a bitcast is appropriate between vector types, take into
consideration the num-of-elements*width-of-element width. Disallow casts when such width is not equal between the vector types otherwise we may end up with an invalid LLVM bitcast. rdar://15722308. llvm-svn: 198474
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/ext_vector_casts.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/Sema/ext_vector_casts.c b/clang/test/Sema/ext_vector_casts.c
index 66004b03ff8..64dcd64cbda 100644
--- a/clang/test/Sema/ext_vector_casts.c
+++ b/clang/test/Sema/ext_vector_casts.c
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -fsyntax-only -verify -fno-lax-vector-conversions %s
typedef __attribute__(( ext_vector_type(2) )) float float2;
+typedef __attribute__(( ext_vector_type(3) )) float float3;
typedef __attribute__(( ext_vector_type(4) )) int int4;
typedef __attribute__(( ext_vector_type(8) )) short short8;
typedef __attribute__(( ext_vector_type(4) )) float float4;
@@ -11,12 +12,15 @@ typedef size_t stride4 __attribute__((ext_vector_type(4)));
static void test() {
float2 vec2;
+ float3 vec3;
float4 vec4, vec4_2;
int4 ivec4;
short8 ish8;
t3 vec4_3;
int *ptr;
int i;
+
+ vec3 += vec2; // expected-error {{can't convert between vector values of different size}}
vec4 = 5.0f;
vec4 = (float4)5.0f;
OpenPOWER on IntegriCloud