Fix crash on MallocInsts of unsized types.

llvm-svn: 19988
This commit is contained in:
Alkis Evlogimenos 2005-02-02 04:43:37 +00:00
parent a856b4db61
commit 3521fcb18f

View File

@ -47,7 +47,8 @@ static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty,
// Deal with the type to allocate, not the pointer type...
Ty = cast<PointerType>(Ty)->getElementType();
if (!Ty->isSized()) return false; // Can only alloc something with a size
if (!Ty->isSized() || !MI->getType()->getElementType()->isSized())
return false; // Can only alloc something with a size
// Analyze the number of bytes allocated...
ExprType Expr = ClassifyExpr(MI->getArraySize());