From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4719 invoked by alias); 30 Dec 2014 23:09:54 -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 4666 invoked by uid 48); 30 Dec 2014 23:09:48 -0000 From: "daniel.c.klauer at web dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/64384] mingw-w64: stdcall function returning an aggregate is incompatible with MS ABI Date: Tue, 30 Dec 2014 23:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: daniel.c.klauer at web dot de 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: cc 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-12/txt/msg02978.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384 daniel.c.klauer at web dot de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.c.klauer at web dot de --- Comment #3 from daniel.c.klauer at web dot de --- It seems there is a difference between gcc and ms with regards to return in register for C++ methods (regardless of stdcall/cdecl/thiscall). Tested with i686-w64-mingw32 gcc 4.9.2 and cl.exe from VS 2010: struct A { int field1; }; struct A getA(void) { struct A a = {123}; return a; } C function: both gcc and ms return in register (struct is small enough), ok. struct A { int field1; }; class Test { public: A getA(); }; A Test::getA() { struct A a = {123}; return a; } C++ method: ms returns in temp var on stack (as for big structs), but gcc returns in register. The same happens for struct containing two floats (as in the original crash issue reported on mingw-w64 mailing list). Maybe (on 32bit) ms never uses return in register for C++ methods with aggregate result?