Skip to content

Commit

Permalink
Attempt to fix issue ldc-developers#1608
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke authored and redstar committed Jul 29, 2016
1 parent 7974fdd commit b9ee9e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions gen/arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,6 @@ void DtoArrayAssign(Loc &loc, DValue *lhs, DValue *rhs, int op,
Type *const elemType = t->nextOf()->toBasetype();
const bool needsDestruction =
(!isConstructing && elemType->needsDestruction());
const bool needsPostblit =
(op != TOKblit && !canSkipPostblit && arrayNeedsPostblit(t));

LLValue *realLhsPtr = DtoArrayPtr(lhs);
LLValue *lhsPtr = DtoBitCast(realLhsPtr, getVoidPtrType());
LLValue *lhsLength = DtoArrayLen(lhs);
Expand All @@ -264,6 +261,11 @@ void DtoArrayAssign(Loc &loc, DValue *lhs, DValue *rhs, int op,
LLValue *rhsPtr = DtoBitCast(realRhsArrayPtr, getVoidPtrType());
LLValue *rhsLength = DtoArrayLen(rhs);

if (t2->ty == Tarray)
canSkipPostblit = false;
const bool needsPostblit =
(op != TOKblit && !canSkipPostblit && arrayNeedsPostblit(t));

if (!needsDestruction && !needsPostblit) {
// fast version
LLValue *elemSize =
Expand Down Expand Up @@ -296,6 +298,9 @@ void DtoArrayAssign(Loc &loc, DValue *lhs, DValue *rhs, int op,
call.setCallingConv(llvm::CallingConv::C);
}
} else {
const bool needsPostblit =
(op != TOKblit && !canSkipPostblit && arrayNeedsPostblit(t));

// scalar rhs:
// T[] = T T[n][] = T
// T[n] = T T[n][m] = T
Expand Down
2 changes: 1 addition & 1 deletion tests/d2/dmd-testsuite
Submodule dmd-testsuite updated 1 files
+25 −0 runnable/ldc_github_1608.d

0 comments on commit b9ee9e9

Please sign in to comment.