------- Comment #7 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-08-10 19:36 ------- Worse, try to return these structures with -freg-struct-return and it also follows this inconsistent pattern, some are returned in EAX:EDX, some are returned in ST(0).
It is even inconsistent between GCC releases: struct { float a[1]; float a[0]; } is returned in EAX on GCC-3.3 and in ST(0) on GCC-3.4 and GCC-4. It is much worse than regparm inconsistency because some operating systems (for example FreeBSD) use -freg-struct-return as a default calling convention and GCC generates incompatible code for them. Where is this "-freg-struct-return" thing documented. The documentation in manpage, "Return 'struct' and 'union' values in registers when possible." is really inadequate. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41017