mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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
This commit is contained in:
parent
79bda7fbe2
commit
0b84c80c08
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user