From 346bb20409eed1cf86f1d257a7d928e357e41300 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Wed, 2 Feb 2005 04:43:37 +0000 Subject: Fix crash on MallocInsts of unsized types. llvm-svn: 19988 --- llvm/lib/Transforms/ExprTypeConvert.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/ExprTypeConvert.cpp b/llvm/lib/Transforms/ExprTypeConvert.cpp index 675ad7b1aa6..0389daacf77 100644 --- a/llvm/lib/Transforms/ExprTypeConvert.cpp +++ b/llvm/lib/Transforms/ExprTypeConvert.cpp @@ -47,7 +47,8 @@ static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty, // Deal with the type to allocate, not the pointer type... Ty = cast(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()); -- cgit v1.2.3