From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16768 invoked by alias); 7 May 2014 10:27:01 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16462 invoked by uid 48); 7 May 2014 10:26:56 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61082] [x86-64 Itanium ABI] g++ uses wrong return location for class with head padding Date: Wed, 07 May 2014 10:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: major X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00474.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61082 --- Comment #4 from Jonathan Wakely --- extern "C" int printf(const char*, ...); struct B { }; struct X : public B { long p; }; struct Y : public B { X q; }; Y foo( Y& y ) { Y temp; temp = y; return temp; } int main( void ) { printf("%zd %zd\n", sizeof( X ), sizeof( Y )); Y y; y.q.p = 6L; Y yy = foo( y ); printf("%ld\n", yy.q.p); } Clang uses the same registers as GCC: .globl _Z3fooR1Y .align 16, 0x90 .type _Z3fooR1Y,@function _Z3fooR1Y: # @_Z3fooR1Y .cfi_startproc # BB#0: # %entry movq 8(%rdi), %rax retq .Ltmp0: .size _Z3fooR1Y, .Ltmp0-_Z3fooR1Y .cfi_endproc