diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-23 17:36:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-23 17:36:49 +0000 |
commit | 8a334a4035ecbfcbba7f0e8613c352349be65271 (patch) | |
tree | c904ff3a786683b555256586c27f99eae46784c9 /lib/Transforms/TransformInternals.cpp | |
parent | 80544444a300fa374a8a46d06d1f910b9da5516c (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/TransformInternals.cpp')
-rw-r--r-- | lib/Transforms/TransformInternals.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index 7aa5564fbe..c8e5ecc5f2 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -119,6 +119,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, if (!ElTy->isSized() || (isa<PointerType>(CompTy) && !Indices.empty())) return 0; // Type is unreasonable... escape! unsigned ElSize = TD.getTypeSize(ElTy); + if (ElSize == 0) return 0; // Avoid division by zero... int64_t ElSizeS = ElSize; // See if the user is indexing into a different cell of this array... |