Mercurial > projects > ldc
changeset 1342:16d9afa22df4
Fix DtoArrayCopyToSlice by passing length*sizeof(element) instead of just length to _d_array_slice_copy.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 10 May 2009 22:26:04 +0200 |
parents | 681dd955c53b |
children | c21a6654cce2 |
files | gen/arrays.cpp |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/arrays.cpp Sun May 10 20:22:08 2009 +0200 +++ b/gen/arrays.cpp Sun May 10 22:26:04 2009 +0200 @@ -364,12 +364,15 @@ 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 {