forked from OSchip/llvm-project
fix PR6332, allowing an index of zero into a zero sized array
even if the element of the array has no size. llvm-svn: 101662
This commit is contained in:
parent
b927073f2e
commit
0a8d91a816
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
; RUN: llc %s -o -
|
||||
|
||||
; PR6332
|
||||
%struct.AVCodecTag = type opaque
|
||||
@ff_codec_bmp_tags = external global [0 x %struct.AVCodecTag]
|
||||
@tags = global [1 x %struct.AVCodecTag*] [%struct.AVCodecTag* getelementptr
|
||||
inbounds ([0 x %struct.AVCodecTag]* @ff_codec_bmp_tags, i32 0, i32 0)]
|
||||
|
Loading…
Reference in New Issue