diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-13 23:26:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-13 23:26:48 +0000 |
commit | 0b84c80c08a920b42458e8be00f8764d76ad00f1 (patch) | |
tree | 9e17b9669b4d7f6522c9ceca8fe2e76f455998f6 /lib/Transforms | |
parent | 79bda7fbe23e6668e1ee53a80f91856f152600a6 (diff) |
Do not overrun iterators. This fixes a 176.gcc crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index b8ff3d4e7e..e8f52d1157 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2104,10 +2104,9 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { uint64_t PtrSizeMask = ~0ULL; PtrSizeMask >>= 64-(TD.getPointerSize()*8); - ++GTI; // Measure type stepping over. for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); - uint64_t Size = TD.getTypeSize(*GTI) & PtrSizeMask; + uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; Constant *Scale = ConstantExpr::getCast(ConstantUInt::get(UIntPtrTy, Size), SIntPtrTy); if (Constant *OpC = dyn_cast<Constant>(Op)) { |