This manifested as an assertion failure in +Asserts builds, and a hard crash in -Asserts builds. Found by fuzzing the LL parser.
llvm-svn: 230934
return true;
Type *PtrTy = Ptr->getType();
+ if (!isa<SequentialType>(PtrTy))
+ return Error(Loc, "pointer type is not valid");
if (VectorType *VT = dyn_cast<VectorType>(PtrTy))
PtrTy = VT->getElementType();
if (Ty != cast<SequentialType>(PtrTy)->getElementType())
--- /dev/null
+; RUN: not llvm-as < %s >/dev/null 2> %t
+; RUN: FileCheck %s < %t
+; Test the case of an invalid pointer type on a GEP
+
+; CHECK: pointer type is not valid
+
+define i32* @foo(i32 %a) {
+ %gep = getelementptr i32, i32 %a, i32 1
+ return i32* %gep
+}
+