x86: big structure return

Cezar Harabula cezar.harabula@open-plug.com
Wed May 26 12:01:00 GMT 2004


Hi,
I work with both GCC and VC6 compilers and I have a return incompatibility:

When a function returns a big structure (>8 bytes), there is not enough 
space in registers, so this big structure is transmitted by address (an 
address in EAX); this address was previously taken from the top of the 
stack. The difference between GCC and VC6 is the following:

VC6 exits with
ret

GCC exits with
ret 4
(unwinds the stack; the 4 bytes which are popped represent that address 
for the structure to be returned, proposed to the callee).

My question: how to impose to GCC not to pop that dword?

I tried with
#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
in the body of my main.c, but the dissassembled code is the same :-(

Cezar



More information about the Gcc-help mailing list