From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19130 invoked by alias); 11 May 2003 09:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19114 invoked by uid 71); 11 May 2003 09:06:01 -0000 Date: Sun, 11 May 2003 09:06:00 -0000 Message-ID: <20030511090601.19113.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Dan Nicolaescu Subject: Re: optimization/6880: Inlining inefficiencies Reply-To: Dan Nicolaescu X-SW-Source: 2003-05/txt/msg01059.txt.bz2 List-Id: The following reply was made to PR optimization/6880; it has been noted by GNATS. From: Dan Nicolaescu To: Dara Hazeghi Cc: gcc-gnats@gcc.gnu.org Subject: Re: optimization/6880: Inlining inefficiencies Date: Sun, 11 May 2003 02:04:06 -0700 The problem still occurs in mainline CVS. But it is not caused by inlining. The problem is the compiler generated copy constructor. Given the following code: class Complex { public: int re, im; Complex( int r, int i ) : re(r), im(i) {} #ifdef MYCONSTRUCTOR Complex( const Complex & F ) : re(F.re), im(F.im) {} #endif Complex() {} }; Complex Yy; void oop_style() { Complex factor (53, 37); Yy = factor; } The oop_style function is compiled to (on x86): _Z9oop_stylev: .LFB11: subl $12, %esp #, .LCFI0: movl $53, (%esp) #, movl (%esp), %edx #, tmp64 movl $37, 4(%esp) #, .im movl 4(%esp), %ecx #, movl %edx, Yy # tmp64, movl %ecx, Yy+4 #, addl $12, %esp #, ret when using g++ -O3 -fverbose-asm -fomit-frame-pointer and to: _Z9oop_stylev: .LFB14: subl $28, %esp #, .LCFI0: movl $53, %eax #, movl $37, %edx #, movl %eax, Yy #, movl %edx, Yy+4 #, addl $28, %esp #, ret when using g++ -O3 -DMYCONSTRUCTOR -fverbose-asm -fomit-frame-pointer Note the extra move to the stack when using the compiler generated constructor. Can the name of the bug be changed to "Inefficient compiler generated copy constructor" and be moved to the C++ category? Or should I file a new bug report?