Changes in directory llvm/lib/Analysis/DataStructure:
Local.cpp updated: 1.144 -> 1.145 --- Log message: Handle some kernel code than ends in [0 x sbyte]. I think this is safe --- Diffs of the changes: (+11 -2) Local.cpp | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.144 llvm/lib/Analysis/DataStructure/Local.cpp:1.145 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.144 Tue Apr 4 21:42:36 2006 +++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Apr 13 14:31:49 2006 @@ -1116,8 +1116,17 @@ const StructLayout *SL = TD.getStructLayout(CS->getType()); for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) { DSNode *NHN = NH.getNode(); - DSNodeHandle NewNH(NHN, NH.getOffset()+(unsigned)SL->MemberOffsets[i]); - MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i))); + //Some programmers think ending a structure with a [0 x sbyte] is cute + //This should be ok as the allocation type should grow this type when + //it is merged in if it is bigger. + if (SL->MemberOffsets[i] < SL->StructSize) { + DSNodeHandle NewNH(NHN, NH.getOffset()+(unsigned)SL->MemberOffsets[i]); + MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i))); + } else if (SL->MemberOffsets[i] == SL->StructSize) { + DEBUG(std::cerr << "Zero size element at end of struct\n"); + } else { + assert(0 && "type was smaller than offsets of of struct layout indicate"); + } } } else if (isa<ConstantAggregateZero>(C) || isa<UndefValue>(C)) { // Noop _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits