public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
       [not found] <bug-36834-4@http.gcc.gnu.org/bugzilla/>
@ 2010-12-18 10:16 ` ktietz at gcc dot gnu.org
  2010-12-18 10:38 ` ktietz at gcc dot gnu.org
  2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  2 siblings, 0 replies; 14+ messages in thread
From: ktietz at gcc dot gnu.org @ 2010-12-18 10:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834

--- Comment #13 from Kai Tietz <ktietz at gcc dot gnu.org> 2010-12-18 10:16:16 UTC ---
Author: ktietz
Date: Sat Dec 18 10:16:13 2010
New Revision: 168019

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168019
Log:
2010-12-18  Kai Tietz  <kai.tietz@onevision.com>

    PR target/36834
    * config/i386/i386.c (ix86_keep_aggregate_return_pointer):
    New local function.
    (ix86_return_pops_args): Use ix86_keep_aggregate_return_pointer
    function instead of KEEP_AGGREGATE_RETURN_POINTER.
    (ix86_handle_callee_pop_aggregate_return): New handler.
    (ix86_attribute_table): Add new attribute
    callee_pop_aggregate_return.
    * doc/extend.texi (callee_pop_aggregate_return): Add
    attribute documentation.

2010-12-18  Kai Tietz  <kai.tietz@onevision.com>

    PR target/36834
    * gcc.target/i386/aggregate-ret1.c: New.
    * gcc.target/i386/aggregate-ret2.c: New.


Added:
    trunk/gcc/testsuite/gcc.target/i386/aggregate-ret1.c
    trunk/gcc/testsuite/gcc.target/i386/aggregate-ret2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
       [not found] <bug-36834-4@http.gcc.gnu.org/bugzilla/>
  2010-12-18 10:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC ktietz at gcc dot gnu.org
@ 2010-12-18 10:38 ` ktietz at gcc dot gnu.org
  2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  2 siblings, 0 replies; 14+ messages in thread
From: ktietz at gcc dot gnu.org @ 2010-12-18 10:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
      Known to fail|                            |

--- Comment #14 from Kai Tietz <ktietz at gcc dot gnu.org> 2010-12-18 10:38:11 UTC ---
By this new attribute functions can be explicit marked to use VC compatible
aggregate return pointer handling.
I don't plan to backmerge this fix to 4.5.x tree, so I close this bug as fixed
for 4.6 tree. For 4.7 there is planned to introduce for mingw 32-bit target the
callabi MS_ABI/SYSV_ABI (as it is already present for 64-bit mingw target).
This will then automatically switch on MS specific calling convention changes -
eg ms-bitfield, caller-pops-aggregate-return, and co.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
       [not found] <bug-36834-4@http.gcc.gnu.org/bugzilla/>
  2010-12-18 10:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC ktietz at gcc dot gnu.org
  2010-12-18 10:38 ` ktietz at gcc dot gnu.org
@ 2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  2 siblings, 0 replies; 14+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #15 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (9 preceding siblings ...)
  2009-03-23 22:10 ` dannysmith at users dot sourceforge dot net
@ 2009-06-24 12:05 ` ktietz at gcc dot gnu dot org
  10 siblings, 0 replies; 14+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-06-24 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from ktietz at gcc dot gnu dot org  2009-06-24 12:05 -------
As I read this. Would it make sense to use for x86-mingw the callabi feature
(as we do for the x64 variant)? This would be useful for 32-bit based multilib
version, too (but this is more a side-note for this).

Kai


-- 

ktietz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (8 preceding siblings ...)
  2009-03-21 21:49 ` mattias at virtutech dot se
@ 2009-03-23 22:10 ` dannysmith at users dot sourceforge dot net
  2009-06-24 12:05 ` ktietz at gcc dot gnu dot org
  10 siblings, 0 replies; 14+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2009-03-23 22:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from dannysmith at users dot sourceforge dot net  2009-03-23 22:10 -------
(In reply to comment #10)
> Note that C++ objects need not be larger than 8 bytes to qualify for returning
> on the stack (and thus subject to this cleanup problem). Any class with a copy
> constructor, for example, seems to be affected.

Thanks.  I understand your concern now.  
Do you think that a function  __attibute__((ms-aggregate-return)) would be 
useful to specify individual problematic functions.
I expect that this would be equivalent to 
(__attribute__((target("ms-aggregate-return"))) which should work now, but I
haven't tested,  Will do so soon.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (7 preceding siblings ...)
  2009-03-21 16:46 ` mattias at virtutech dot se
@ 2009-03-21 21:49 ` mattias at virtutech dot se
  2009-03-23 22:10 ` dannysmith at users dot sourceforge dot net
  2009-06-24 12:05 ` ktietz at gcc dot gnu dot org
  10 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2009-03-21 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mattias at virtutech dot se  2009-03-21 21:49 -------
Note that C++ objects need not be larger than 8 bytes to qualify for returning
on the stack (and thus subject to this cleanup problem). Any class with a copy
constructor, for example, seems to be affected.
Try compiling:

struct A {
  A();
  A(const A&);
  int x;
};
A f() { return A(); }

This is probably why methods returning string::reverse_iterator make the list.
(http://www.agner.org/optimize/calling_conventions.pdf was useful for
understanding this.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (6 preceding siblings ...)
  2009-03-21  1:04 ` dannysmith at users dot sourceforge dot net
@ 2009-03-21 16:46 ` mattias at virtutech dot se
  2009-03-21 21:49 ` mattias at virtutech dot se
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2009-03-21 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mattias at virtutech dot se  2009-03-21 16:45 -------
Created an attachment (id=17508)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17508&action=view)
Functions in libstdc++ returning aggregates > 8 bytes

These are the functions in libstdc++ that contain the instruction "ret 0x4",
assuming that they correspond exactly to those returning aggregates larger than
8 bytes. There are 127 of them.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (5 preceding siblings ...)
  2009-03-20 17:17 ` mattias at virtutech dot se
@ 2009-03-21  1:04 ` dannysmith at users dot sourceforge dot net
  2009-03-21 16:46 ` mattias at virtutech dot se
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2009-03-21  1:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dannysmith at users dot sourceforge dot net  2009-03-21 01:03 -------
(In reply to comment #7)
> The proposed patch works for plain C code, but also affects C++. Since
> libstdc++ contains code that returns aggregates or calls code that does,

An example, please.  The patch only affects functions that return large (> 8
bytes) aggregates by value.

Danny

> -mms-aggregate-return will make the generated code incompatible with the C++
> library. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2009-03-14 21:14 ` rogerpack2005 at gmail dot com
@ 2009-03-20 17:17 ` mattias at virtutech dot se
  2009-03-21  1:04 ` dannysmith at users dot sourceforge dot net
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2009-03-20 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mattias at virtutech dot se  2009-03-20 17:16 -------
The proposed patch works for plain C code, but also affects C++. Since
libstdc++ contains code that returns aggregates or calls code that does,
-mms-aggregate-return will make the generated code incompatible with the C++
library. This makes it impossible to write C++ code that links (as a DLL) to
code compiled with Microsoft or Intel compilers, even if the interface is in
plain C.

We are exactly in this situation. We will have to build libstdc++ with
-mms-aggregate-return, but that option would then become mandatory for all C++
code. Things would be easier if the option were on by default - we can do this
for our build locally, of course, but we'd rather not diverge too much from the
standard behaviour.

An alternative would be to make the option only affect C (including extern "C"
in C++), as other languages are not subject to compatibility with MS compilers.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2009-03-11 12:43 ` mattias at virtutech dot se
@ 2009-03-14 21:14 ` rogerpack2005 at gmail dot com
  2009-03-20 17:17 ` mattias at virtutech dot se
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: rogerpack2005 at gmail dot com @ 2009-03-14 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rogerpack2005 at gmail dot com  2009-03-14 21:14 -------
anybody know if this bug is related to this post?
http://www.gamedev.net/community/forums/topic.asp?topic_id=482230
Thanks!
-=roger


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2009-03-11 11:35 ` rogerpack2005 at gmail dot com
@ 2009-03-11 12:43 ` mattias at virtutech dot se
  2009-03-14 21:14 ` rogerpack2005 at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2009-03-11 12:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mattias at virtutech dot se  2009-03-11 12:42 -------
(In reply to comment #4)

>http://209.85.173.132/search?q=cache:e7XCjhLwHacJ:luabinaries.luaforge.net/manual.html+http://luabinaries.luaforge.net/manual.html%23LuaBinariesCompatible&hl=en&ct=clnk&cd=1&gl=us&client=opera
> is it the same bug [they mention incompats when passing CRT objects among
> libraries]? dunno.

No, that page is concerned with multiple CRTs in the same process and passing
around values between them (such as using fopen() in one CRT and fclose() in
another).

This bug is about calling conventions for functions returning structs by value.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
  2008-07-17  8:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC dannysmith at users dot sourceforge dot net
  2008-07-18  9:44 ` mattias at virtutech dot se
@ 2009-03-11 11:35 ` rogerpack2005 at gmail dot com
  2009-03-11 12:43 ` mattias at virtutech dot se
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: rogerpack2005 at gmail dot com @ 2009-03-11 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rogerpack2005 at gmail dot com  2009-03-11 11:35 -------
I'd be willing to offer a small bounty for this one.  Maybe $50 for an accepted
patch that handles both the caller and callee sides?

The problem seems to be common [1].

Thanks!
-=r
[1]
http://209.85.173.132/search?q=cache:e7XCjhLwHacJ:luabinaries.luaforge.net/manual.html+http://luabinaries.luaforge.net/manual.html%23LuaBinariesCompatible&hl=en&ct=clnk&cd=1&gl=us&client=opera
is it the same bug [they mention incompats when passing CRT objects among
libraries]? dunno.


-- 

rogerpack2005 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rogerpack2005 at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
  2008-07-17  8:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC dannysmith at users dot sourceforge dot net
@ 2008-07-18  9:44 ` mattias at virtutech dot se
  2009-03-11 11:35 ` rogerpack2005 at gmail dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: mattias at virtutech dot se @ 2008-07-18  9:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mattias at virtutech dot se  2008-07-18 09:43 -------
Thank you. Should the option be enabled by default on i686-pc-mingw32? Perhaps
not, but it does make good on a previously broken ABI promise.

The test case in that patch only covers the callee, not the caller. The
difference in the calling code is perhaps less easily recognisable.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug target/36834] structure return ABI for windows targets differs from native MSVC
  2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
@ 2008-07-17  8:16 ` dannysmith at users dot sourceforge dot net
  2008-07-18  9:44 ` mattias at virtutech dot se
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2008-07-17  8:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dannysmith at users dot sourceforge dot net  2008-07-17 08:16 -------
Patch submitted
http://gcc.gnu.org/ml/gcc-patches/2008-07/msg01250.html
Danny


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-02-16 13:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-36834-4@http.gcc.gnu.org/bugzilla/>
2010-12-18 10:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC ktietz at gcc dot gnu.org
2010-12-18 10:38 ` ktietz at gcc dot gnu.org
2014-02-16 13:13 ` jackie.rosen at hushmail dot com
2008-07-15  9:28 [Bug target/36834] New: structure return ABI for windows targets differs from nbative MSVC dannysmith at users dot sourceforge dot net
2008-07-17  8:16 ` [Bug target/36834] structure return ABI for windows targets differs from native MSVC dannysmith at users dot sourceforge dot net
2008-07-18  9:44 ` mattias at virtutech dot se
2009-03-11 11:35 ` rogerpack2005 at gmail dot com
2009-03-11 12:43 ` mattias at virtutech dot se
2009-03-14 21:14 ` rogerpack2005 at gmail dot com
2009-03-20 17:17 ` mattias at virtutech dot se
2009-03-21  1:04 ` dannysmith at users dot sourceforge dot net
2009-03-21 16:46 ` mattias at virtutech dot se
2009-03-21 21:49 ` mattias at virtutech dot se
2009-03-23 22:10 ` dannysmith at users dot sourceforge dot net
2009-06-24 12:05 ` ktietz at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).