summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2005-02-02 04:43:37 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2005-02-02 04:43:37 +0000
commit346bb20409eed1cf86f1d257a7d928e357e41300 (patch)
tree4704a99d029fe29960473d9e3de3357117d5f108 /llvm/lib
parent07c0b0d92b67fab2afac0e03af2a12cb892a4c26 (diff)
downloadbcm5719-llvm-346bb20409eed1cf86f1d257a7d928e357e41300.tar.gz
bcm5719-llvm-346bb20409eed1cf86f1d257a7d928e357e41300.zip
Fix crash on MallocInsts of unsized types.
llvm-svn: 19988
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/ExprTypeConvert.cpp3
1 files changed, 2 insertions, 1 deletions
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<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());
OpenPOWER on IntegriCloud