From bf2c46254a1dce11ee0c3c0b78d47f62b665c1d5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 23 Jun 2003 17:36:49 +0000 Subject: avoid dividing by zero when dealing with zero sized types (like [0 x double]) llvm-svn: 6862 --- llvm/lib/Transforms/TransformInternals.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/Transforms/TransformInternals.cpp') diff --git a/llvm/lib/Transforms/TransformInternals.cpp b/llvm/lib/Transforms/TransformInternals.cpp index 7aa5564fbee..c8e5ecc5f2b 100644 --- a/llvm/lib/Transforms/TransformInternals.cpp +++ b/llvm/lib/Transforms/TransformInternals.cpp @@ -119,6 +119,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, if (!ElTy->isSized() || (isa(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... -- cgit v1.2.3