Fix static array null assignment/default initialization

This commit is contained in:
David Nadlinger 2015-07-26 19:34:45 +02:00
parent 901f015ce4
commit 19fd4938be

View file

@ -270,9 +270,17 @@ void DtoArrayAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPost
// fast version
LLValue* elemSize = DtoConstSize_t(getTypePaddedSize(voidToI8(DtoType(elemType))));
LLValue* lhsSize = gIR->ir->CreateMul(elemSize, lhsLength);
if (rhs->isNull())
{
DtoMemSetZero(lhsPtr, lhsSize);
}
else
{
LLValue* rhsSize = gIR->ir->CreateMul(elemSize, rhsLength);
copySlice(loc, lhsPtr, lhsSize, rhsPtr, rhsSize);
}
}
else if (isConstructing)
{
LLFunction* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_arrayctor");