diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2005-02-02 04:43:37 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2005-02-02 04:43:37 +0000 |
commit | 83874c957123ae1ffc75f1220737946d34a9b359 (patch) | |
tree | f033e1ca8f46a99a9af48053b10cea95e5eb31d4 | |
parent | c23d696e71f28f0c9cebb74fc42491dd33e9112a (diff) |
Fix crash on MallocInsts of unsized types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19988 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/ExprTypeConvert.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 675ad7b1aa..0389daacf7 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/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<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()); |