From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31075 invoked by alias); 14 Aug 2005 06:45:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31059 invoked by uid 48); 14 Aug 2005 06:45:51 -0000 Date: Sun, 14 Aug 2005 06:45:00 -0000 Message-ID: <20050814064551.31057.qmail@sourceware.org> From: "guillaume dot melquiond at ens-lyon dot fr" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050813080257.23372.guillaume.melquiond@ens-lyon.fr> References: <20050813080257.23372.guillaume.melquiond@ens-lyon.fr> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg01570.txt.bz2 List-Id: ------- Additional Comments From guillaume dot melquiond at ens-lyon dot fr 2005-08-14 06:45 ------- Looking at it again, I found an even worse regression with respect to g++ 3.4. Consider this testcase: struct A { int a[1000]; } A f(); void g(A); void h() { g(f()); } Ideally, h will allocate a stack frame for g and ask f to directly dump its result in it. No temporary nor memcpy will be used at all. g++ 3.4 behaves this way. g++ 4.0 however will first allocate some space for the result of f, then call f and copy its result in another temporary, and finally it will allocate the stack frame for g and copy the temporary in it. Two temporaries and two memcpys are needed for g++ 4.0. So the same issue arises when returning a result by value. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23372