mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 01:23:14 +01:00
Insert array bound checks for slices.
This commit is contained in:
@@ -1009,12 +1009,12 @@ DValue* IndexExp::toElem(IRState* p)
|
||||
}
|
||||
else if (e1type->ty == Tsarray) {
|
||||
if(global.params.useArrayBounds)
|
||||
DtoArrayBoundsCheck(loc, l, r);
|
||||
DtoArrayBoundsCheck(loc, l, r, false);
|
||||
arrptr = DtoGEP(l->getRVal(), zero, r->getRVal());
|
||||
}
|
||||
else if (e1type->ty == Tarray) {
|
||||
if(global.params.useArrayBounds)
|
||||
DtoArrayBoundsCheck(loc, l, r);
|
||||
DtoArrayBoundsCheck(loc, l, r, false);
|
||||
arrptr = DtoArrayPtr(l);
|
||||
arrptr = DtoGEP1(arrptr,r->getRVal());
|
||||
}
|
||||
@@ -1071,6 +1071,9 @@ DValue* SliceExp::toElem(IRState* p)
|
||||
LLValue* vlo = lo->getRVal();
|
||||
LLValue* vup = up->getRVal();
|
||||
|
||||
if(global.params.useArrayBounds && (etype->ty == Tsarray || etype->ty == Tarray))
|
||||
DtoArrayBoundsCheck(loc, e, up, true);
|
||||
|
||||
// offset by lower
|
||||
eptr = DtoGEP1(eptr, vlo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user