From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1873) id BC968393D017; Fri, 30 Jul 2021 10:56:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC968393D017 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain Buclaw To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2620] d: Clarify comment for generating static array assignment with literal. X-Act-Checkin: gcc X-Git-Author: Iain Buclaw X-Git-Refname: refs/heads/master X-Git-Oldrev: 370f66b6af3e70ac31593d60a00d328a3368834a X-Git-Newrev: c18db639a31b9d651b3b997fee331106b25789ef Message-Id: <20210730105616.BC968393D017@sourceware.org> Date: Fri, 30 Jul 2021 10:56:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 10:56:16 -0000 https://gcc.gnu.org/g:c18db639a31b9d651b3b997fee331106b25789ef commit r12-2620-gc18db639a31b9d651b3b997fee331106b25789ef Author: Iain Buclaw Date: Mon Jul 26 19:22:48 2021 +0200 d: Clarify comment for generating static array assignment with literal. The code block is done as an optimization to elide a call to the runtime library helpers _d_arrayctor or _d_arrayassign. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssignExp *)): Clarify comment for generating static array assignment with literal. Diff: --- gcc/d/expr.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 85269c6b2be..76c1e613e77 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -1163,9 +1163,9 @@ public: bool destructor = needs_dtor (etype); bool lvalue = lvalue_p (e->e2); - /* Even if the elements in rhs are all rvalues and don't have - to call postblits, this assignment should call dtors on old - assigned elements. */ + /* Optimize static array assignment with array literal. Even if the + elements in rhs are all rvalues and don't have to call postblits, + this assignment should call dtors on old assigned elements. */ if ((!postblit && !destructor) || (e->op == TOKconstruct && e->e2->op == TOKarrayliteral) || (e->op == TOKconstruct && !lvalue && postblit)