diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-22 19:15:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-22 19:15:27 +0000 |
commit | ddc4860c1d6e06db2db5c08a01dc1ff3293d9daf (patch) | |
tree | b1ed749c770fbee6e2fa37b5554856803b9048e6 | |
parent | b9849700ed30a871609ff663065ab2cd5c1705a4 (diff) | |
download | external_llvm-ddc4860c1d6e06db2db5c08a01dc1ff3293d9daf.zip external_llvm-ddc4860c1d6e06db2db5c08a01dc1ff3293d9daf.tar.gz external_llvm-ddc4860c1d6e06db2db5c08a01dc1ff3293d9daf.tar.bz2 |
Fix test/Regression/CFrontend/2003-11-01-EmptyStructCrash.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18115 91177308-0d34-0410-b5e6-96231b3b80d8
-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 02b7fe2..e208064 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)) { |