mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
fix PR6332, allowing an index of zero into a zero sized array
even if the element of the array has no size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101662 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -630,8 +630,8 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, Value* const* Indices,
|
||||
Ty = cast<SequentialType>(Ty)->getElementType();
|
||||
|
||||
// Get the array index and the size of each array element.
|
||||
int64_t arrayIdx = cast<ConstantInt>(Indices[CurIDX])->getSExtValue();
|
||||
Result += arrayIdx * (int64_t)getTypeAllocSize(Ty);
|
||||
if (int64_t arrayIdx = cast<ConstantInt>(Indices[CurIDX])->getSExtValue())
|
||||
Result += arrayIdx * (int64_t)getTypeAllocSize(Ty);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user