This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Returning unions (Was: Re: Ping^5: Re: Updated^2: RFA: Fix middle-end/46500 (void * encapsulated))
- From: Joern Rennecke <amylaar at spamcop dot net>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: GCC mailing list <gcc at gcc dot gnu dot org>
- Date: Tue, 14 Jun 2011 20:44:38 -0400
- Subject: Returning unions (Was: Re: Ping^5: Re: Updated^2: RFA: Fix middle-end/46500 (void * encapsulated))
- References: <20101116234626.u7kpzzukn34kogkk-nzlynne@webmail.spamcop.net> <20101118223203.muhg2uba8gww48co-nzlynne@webmail.spamcop.net> <20110507114245.8rcb4f6n0gggwggk-nzlynne@webmail.spamcop.net> <Pine.LNX.4.64.1105071546350.24964@digraph.polyomino.org.uk> <Pine.LNX.4.64.1105071559200.24964@digraph.polyomino.org.uk> <20110507151225.qsxqm0ltokc4sw0k-nzlynne@webmail.spamcop.net> <20110514103611.vpdb6r7wcgo8wkg0-nzlynne@webmail.spamcop.net> <20110521153014.mkzu2c9qsc808k4g-nzlynne@webmail.spamcop.net> <20110529232655.0ria73pgzkwo008g-nzlynne@webmail.spamcop.net> <20110604092242.4aaut664f4kcsws4-nzlynne@webmail.spamcop.net> <20110614054034.i5n9pysdoo0gsg4-nzlynne@webmail.spamcop.net> <BANLkTikvJyYfh+WV4kuE7WC6Xy2ftiwCyQ@mail.gmail.com> <20110614071614.upci7rx74scwg4ws-nzlynne@webmail.spamcop.net> <BANLkTikPTj=f27sregKhO8gW2MpBLWVKSA@mail.gmail.com> <4DF75131.8040807@codesourcery.com> <20110614085314.jk6v6p7je04s4080-nzlynne@webmail.spamcop.net> <4DF760F2.2080100@codesourcery.com>
Quoting Bernd Schmidt <bernds@codesourcery.com>:
* Most sane ABIs pass single-word structs in registers
Unfortunately, the i386 SYSV ABI (used generally for i386 elf toolchains)
is half-way insane in that respect: function return of small aggregates also
goes via a caller-passed pointer to a stack slot. (You can avoid that using
-freg-struct-return, but that option is not safe unless you have a
full set of multilibs built with that option.)
* For the most part, gcc runs on i686 and there it doesn't make a
difference.
It used to make a difference for function value return. But apparently
we have lost that feature of transparent union somewhere between gcc 2.7.0
and gcc 4.4.5 .