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
This commit is contained in:
Chris Lattner 2004-11-22 19:15:27 +00:00
parent b9849700ed
commit ddc4860c1d

View File

@ -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)) {