From: Chris Lattner Date: Thu, 13 Jan 2005 23:26:48 +0000 (+0000) Subject: Do not overrun iterators. This fixes a 176.gcc crash X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=0b84c80c08a920b42458e8be00f8764d76ad00f1;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index b8ff3d4e7e7..e8f52d11573 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(Op)) {