diff options
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 02b7fe2975..e2080642ca 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -574,6 +574,7 @@ Constant *llvm::ConstantFoldCastInstruction(const Constant *V, const Type *ElTy = PTy->getElementType(); while (ElTy != DPTy->getElementType()) { if (const StructType *STy = dyn_cast<StructType>(ElTy)) { + if (STy->getNumElements() == 0) break; ElTy = STy->getElementType(0); IdxList.push_back(Constant::getNullValue(Type::UIntTy)); } else if (const SequentialType *STy = dyn_cast<SequentialType>(ElTy)) { |