* [Bug target/36834] structure return ABI for windows targets differs from nbative 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-15 9:30 ` 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
` (10 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2008-07-15 9:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dannysmith at users dot sourceforge dot net 2008-07-15 09:29 -------
Testing a patch to add a new switch for windows targets.
--
dannysmith at users dot sourceforge dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dannysmith at users dot
|dot org |sourceforge dot net
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Known to fail| |4.2.0 4.3.0 4.4.0
Last reconfirmed|0000-00-00 00:00:00 |2008-07-15 09:29:57
date| |
Summary|structure return ABI for |structure return ABI for
|windows targets differs from|windows targets differs from
|nbative MSVC |nbative MSVC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834
^ permalink raw reply [flat|nested] 16+ 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-15 9:30 ` [Bug target/36834] " 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)
11 siblings, 0 replies; 16+ 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] 16+ 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-15 9:30 ` [Bug target/36834] " 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)
11 siblings, 0 replies; 16+ 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] 16+ 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 ...)
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)
11 siblings, 0 replies; 16+ 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] 16+ 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 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)
11 siblings, 0 replies; 16+ 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] 16+ 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-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)
11 siblings, 0 replies; 16+ 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] 16+ 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-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)
11 siblings, 0 replies; 16+ 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] 16+ 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-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)
11 siblings, 0 replies; 16+ 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] 16+ 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 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)
11 siblings, 0 replies; 16+ 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] 16+ 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 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
11 siblings, 0 replies; 16+ 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] 16+ 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-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
11 siblings, 0 replies; 16+ 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] 16+ 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
` (10 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
11 siblings, 0 replies; 16+ 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] 16+ messages in thread