void main() { int[] a = [1,2]; int[] b = [1,2]; a+= b; } arr.d(5): Error: Array operations not implemented <segfault> For any assign operation other than +=, it creates wrong code. It crashes because AddAssignExp::toElem (e2ir.c line 2934) returns an uninitialized variable. error("Array operations not implemented"); + e = el_long(type->totym(), 0); // error recovery But actually I think it's better to put the check into BinExp::toElemBin (e2ir.c line 1968), since this test should be performed for all operations, and then remove the check from AddAssignExp. line 1930: elem *AddAssignExp::toElem(IRState *irs) { return toElemBin(irs,OPaddass); } line 1968: elem *BinExp::toElemBin(IRState *irs,int op) { //printf("toElemBin() '%s'\n", toChars()); + Type *tb1 = e1->type->toBasetype(); + Type *tb2 = e2->type->toBasetype(); + + if ((tb1->ty == Tarray || tb1->ty == Tsarray) && + (tb2->ty == Tarray || tb2->ty == Tsarray) && + (op == OPadd || op == OPmin || op == OPmul || + op == OPdiv || op == OPmod || + op == OPaddass || op == OPminass || op == OPmulass || + op == OPdivass || op == OPmodass) + ) + { + error("Array operation %s not implemented", toChars()); + return el_long(type->totym(), 0); // error recovery + } tym_t tym = type->totym();
changeset 493