Skip to content

Commit

Permalink
Issue 6234 - 64-bit array append generates inline code to copy new da…
Browse files Browse the repository at this point in the history
…ta, but does not call postblit
  • Loading branch information
WalterBright committed Jul 5, 2011
1 parent 45cc9c5 commit 3a87293
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/e2ir.c
Expand Up @@ -3101,8 +3101,12 @@ elem *CatAssignExp::toElem(IRState *irs)
elength = el_bin(OPmin, TYsize_t, elength, el_long(TYsize_t, 1));
elength = el_bin(OPmul, TYsize_t, elength, el_long(TYsize_t, this->e2->type->size()));
eptr = el_bin(OPadd, TYnptr, eptr, elength);
eptr = el_una(OPind, e2->Ety, eptr);
elem *eeq = el_bin(OPeq, e2->Ety, eptr, e2);
StructDeclaration *sd = needsPostblit(tb2);
elem *epost = NULL;
if (sd)
epost = el_same(&eptr);
elem *ederef = el_una(OPind, e2->Ety, eptr);
elem *eeq = el_bin(OPeq, e2->Ety, ederef, e2);

if (tybasic(e2->Ety) == TYstruct)
{
Expand All @@ -3116,6 +3120,14 @@ elem *CatAssignExp::toElem(IRState *irs)
eeq->ET = tb1n->toCtype();
}

/* Need to call postblit on eeq
*/
if (sd)
{ FuncDeclaration *fd = sd->postblit;
epost = callfunc(loc, irs, 1, Type::tvoid, epost, sd->type->pointerTo(), fd, fd->type, NULL, NULL);
eeq = el_bin(OPcomma, epost->Ety, eeq, epost);
}

e = el_combine(e2x, e);
e = el_combine(e, eeq);
e = el_combine(e, el_var(stmp));
Expand Down

1 comment on commit 3a87293

@WalterBright
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.