[llvm-commits] [llvm] r47792 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/Verifier/2008-03-01-AllocaSized.ll
Chris Lattner
sabre at nondot.org
Sat Mar 1 01:01:57 PST 2008
Author: lattner
Date: Sat Mar 1 03:01:57 2008
New Revision: 47792
URL: http://llvm.org/viewvc/llvm-project?rev=47792&view=rev
Log:
Fix PR2113 by verifying allocations.
Added:
llvm/trunk/test/Verifier/2008-03-01-AllocaSized.ll
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=47792&r1=47791&r2=47792&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sat Mar 1 03:01:57 2008
@@ -1041,9 +1041,12 @@
}
void Verifier::visitAllocationInst(AllocationInst &AI) {
- const PointerType *Ptr = AI.getType();
- Assert(Ptr->getAddressSpace() == 0,
- "Allocation instruction pointer not in the generic address space!");
+ const PointerType *PTy = AI.getType();
+ Assert1(PTy->getAddressSpace() == 0,
+ "Allocation instruction pointer not in the generic address space!",
+ &AI);
+ Assert1(PTy->getElementType()->isSized(), "Cannot allocate unsized type",
+ &AI);
visitInstruction(AI);
}
Added: llvm/trunk/test/Verifier/2008-03-01-AllocaSized.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/2008-03-01-AllocaSized.ll?rev=47792&view=auto
==============================================================================
--- llvm/trunk/test/Verifier/2008-03-01-AllocaSized.ll (added)
+++ llvm/trunk/test/Verifier/2008-03-01-AllocaSized.ll Sat Mar 1 03:01:57 2008
@@ -0,0 +1,8 @@
+; RUN: not llvm-as -f %s -o /dev/null |& grep {Cannot allocate unsized type}
+; PR2113
+
+define void @test() {
+ %A = alloca void()
+ ret void
+}
+
More information about the llvm-commits
mailing list