mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-09 00:13:14 +01:00
Fix DtoArrayCopyToSlice by passing length*sizeof(element) instead of just length to _d_array_slice_copy.
This commit is contained in:
@@ -364,12 +364,15 @@ void DtoArrayCopyToSlice(DSliceValue* dst, DValue* src)
|
||||
|
||||
LLValue* sz1;
|
||||
LLValue* dstarr = get_slice_ptr(dst,sz1);
|
||||
|
||||
LLValue* srcarr = DtoBitCast(DtoArrayPtr(src), getVoidPtrType());
|
||||
const LLType* arrayelemty = DtoType(src->getType()->nextOf()->toBasetype());
|
||||
LLValue* sz2 = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(arrayelemty)), DtoArrayLen(src), "tmp");
|
||||
|
||||
if (global.params.useAssert || global.params.useArrayBounds)
|
||||
{
|
||||
LLValue* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_slice_copy");
|
||||
gIR->CreateCallOrInvoke4(fn, dstarr, sz1, srcarr, DtoArrayLen(src));
|
||||
gIR->CreateCallOrInvoke4(fn, dstarr, sz1, srcarr, sz2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user