mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Use typed gep in arrays.cpp
(#4098)
This commit is contained in:
parent
f8aaca4bd3
commit
ccd24cc09a
1 changed files with 2 additions and 1 deletions
|
@ -808,9 +808,10 @@ void DtoCatAssignElement(const Loc &loc, DValue *array, Expression *exp) {
|
|||
// Assign to the new last element.
|
||||
LLValue *newLength = DtoArrayLen(array);
|
||||
LLValue *ptr = DtoArrayPtr(array);
|
||||
LLType *ptrty = i1ToI8(DtoType(array->type->nextOf()));
|
||||
LLValue *lastIndex =
|
||||
gIR->ir->CreateSub(newLength, DtoConstSize_t(1), ".lastIndex");
|
||||
LLValue *lastElemPtr = DtoGEP1(ptr, lastIndex, ".lastElem");
|
||||
LLValue *lastElemPtr = DtoGEP1(ptrty, ptr, lastIndex, ".lastElem");
|
||||
DLValue lastElem(arrayType->nextOf(), lastElemPtr);
|
||||
DtoAssign(loc, &lastElem, expVal, EXP::blit);
|
||||
callPostblit(loc, exp, lastElemPtr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue