aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/ExprTypeConvert.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-23 17:36:49 +0000
committerChris Lattner <sabre@nondot.org>2003-06-23 17:36:49 +0000
commit8a334a4035ecbfcbba7f0e8613c352349be65271 (patch)
treec904ff3a786683b555256586c27f99eae46784c9 /lib/Transforms/ExprTypeConvert.cpp
parent80544444a300fa374a8a46d06d1f910b9da5516c (diff)
avoid dividing by zero when dealing with zero sized types (like [0 x double])
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/ExprTypeConvert.cpp')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index b7936377e7..e830beee44 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -49,6 +49,7 @@ static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty,
// Get information about the base datatype being allocated, before & after
int ReqTypeSize = TD.getTypeSize(Ty);
+ if (ReqTypeSize == 0) return false;
unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
// Must have a scale or offset to analyze it...