From 79e3fb53d618d12e239275ef055200bbd6f8253e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 22 Jan 2014 19:21:33 +0000 Subject: Bug 18228 - Fix accepting bitcasts between vectors of pointers with a different number of elements. Bitcasts were passing with vectors of pointers with different number of elements since the number of elements was checking SrcTy->getVectorNumElements() == SrcTy->getVectorNumElements() which isn't helpful. The addrspacecast was also wrong, but that case at least is caught by the verifier. Refactor bitcast and addrspacecast handling in castIsValid to be more readable and fix this problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199821 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Assembler/invalid_cast3.ll | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/Assembler/invalid_cast3.ll (limited to 'test/Assembler') diff --git a/test/Assembler/invalid_cast3.ll b/test/Assembler/invalid_cast3.ll new file mode 100644 index 0000000000..cc956cee59 --- /dev/null +++ b/test/Assembler/invalid_cast3.ll @@ -0,0 +1,7 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +; CHECK: invalid cast opcode for cast from '<4 x i32*>' to '<2 x i32*>' +define <2 x i32*> @illegal_vector_pointer_bitcast_num_elements(<4 x i32*> %c) { + %bc = bitcast <4 x i32*> %c to <2 x i32*> + ret <2 x i32*> %bc +} -- cgit v1.2.3