From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12158 invoked by alias); 7 Oct 2004 11:51:29 -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 12101 invoked by uid 48); 7 Oct 2004 11:51:27 -0000 Date: Thu, 07 Oct 2004 11:51:00 -0000 Message-ID: <20041007115127.12100.qmail@sourceware.org> From: "giovannibajo at libero dot it" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040707115615.16405.guillaume.melquiond@ens-lyon.fr> References: <20040707115615.16405.guillaume.melquiond@ens-lyon.fr> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/16405] [3.4/4.0 Regression] Temporary aggregate copy not elided X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg00909.txt.bz2 List-Id: ------- Additional Comments From giovannibajo at libero dot it 2004-10-07 11:51 ------- Confirmed. This won't probably be fixed in the 3.4 branch, but it should in 4.0 at least. Testcase (same of original description): ------------------------------------ struct T { int a[128]; T &operator+=(T const &v); T operator+(T const &v) const { T t = *this; t += v; return t; } }; extern T a, b, c; void f() { a = b + c; } ------------------------------------ The optimized dump (without the copy constructor) from mainline is: ------------------------------------ void f() () { struct T t; struct T * const this; struct T & v; struct T * D.1598; struct T D.1594; struct T t; : t = b; operator+= (&t, &c); D.1594 = t; a = D.1594; return; } ------------------------------------ So there is one additional temporary which is not removed. I cannot see a regression anymore with the copy constructor, so this bug only tracks this now. Guillaume, if you still see a regression with the copy constructor please open a new bug report. It is wrong to track two different testcases (although similar) in the same report. -- What |Removed |Added ---------------------------------------------------------------------------- CC| |giovannibajo at libero dot | |it Status|UNCONFIRMED |NEW Ever Confirmed| |1 Known to fail| |3.4.3 4.0.0 Known to work| |3.3.4 Last reconfirmed|0000-00-00 00:00:00 |2004-10-07 11:51:22 date| | Summary|Non optimized code when |[3.4/4.0 Regression] |using default copy |Temporary aggregate copy not |constructor |elided Target Milestone|--- |3.4.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16405