d: Fix LHS of array concatentation evaluated before the RHS.
In an array append expression:
array ~= fun(array);
The array in the left hand side of the expression was extended before
evaluating the result of the right hand side, which resulted in the
newly uninitialized array index being used before set.
This fixes that so that the result of the right hand side is always
saved in a reusable temporary before assigning to the destination.
gcc/d/ChangeLog:
PR d/97843
* d-codegen.cc (build_assign): Evaluate TARGET_EXPR before use in
the right hand side of an assignment.
* expr.cc (ExprVisitor::visit (CatAssignExp *)): Force a TARGET_EXPR
on the element to append if it is a CALL_EXPR.
gcc/testsuite/ChangeLog:
PR d/97843
* gdc.dg/torture/pr97843.d: New test.