Enable array bounds check and emit them in IndexExp.

This commit is contained in:
Christian Kamm
2008-07-30 18:38:56 +02:00
parent fc9ccb9f6a
commit 7882f4858e
4 changed files with 82 additions and 1 deletions

View File

@@ -1008,9 +1008,13 @@ DValue* IndexExp::toElem(IRState* p)
arrptr = DtoGEP1(l->getRVal(),r->getRVal());
}
else if (e1type->ty == Tsarray) {
if(global.params.useArrayBounds)
DtoArrayBoundsCheck(loc, l, r);
arrptr = DtoGEP(l->getRVal(), zero, r->getRVal());
}
else if (e1type->ty == Tarray) {
if(global.params.useArrayBounds)
DtoArrayBoundsCheck(loc, l, r);
arrptr = DtoArrayPtr(l);
arrptr = DtoGEP1(arrptr,r->getRVal());
}