https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97843
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Iain Buclaw <ibuc...@gcc.gnu.org>: https://gcc.gnu.org/g:bbb887834d78cf6a444bf9cecc29d14b4dfb9cf8 commit r10-9043-gbbb887834d78cf6a444bf9cecc29d14b4dfb9cf8 Author: Iain Buclaw <ibuc...@gdcproject.org> Date: Tue Nov 17 13:11:33 2020 +0100 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/pr97843.d: New test. (cherry picked from commit 798bdfa0ebcf2bd012ffce75a594f783a8cb2dd0)