[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Nov 22 11:15:41 PST 2004



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.68 -> 1.69
---
Log message:

Fix test/Regression/CFrontend/2003-11-01-EmptyStructCrash.c


---
Diffs of the changes:  (+1 -0)

Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.68 llvm/lib/VMCore/ConstantFolding.cpp:1.69
--- llvm/lib/VMCore/ConstantFolding.cpp:1.68	Wed Nov 17 11:59:35 2004
+++ llvm/lib/VMCore/ConstantFolding.cpp	Mon Nov 22 13:15:27 2004
@@ -574,6 +574,7 @@
       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)) {






More information about the llvm-commits mailing list