This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Returning structures


Geoffrey Keating <geoffk@thief.cygnus.com> wrote:

> So I intend to change calls.c so
> that it always allocates a buffer.

Is it just going to allocate the buffer and offer it to the callee, but still
look for the struct return value where the callee points on return (in the
register normally used to return pointers), or is it going to expect the struct
return value in the buffer?

> Does anyone know of any ABIs which do not have this requirement?  I am
> wondering if this should be left conditional or removed altogether.

The PCC ABI on all UNIXes with native PCC (VAX BSD, VAX Ultrix, m68k SunOS,
m68k BSD, and a few others) allows the callee to put the struct return value
where it chooses (PCC puts it in a static buffer) but requires it to return a
pointer to it. The caller is required to honor this pointer.

In GCC these targets define PCC_STATIC_STRUCT_RETURN. So far the only problem I
have found with it in the current GCC is the C++ front end breakage (although
it's bad enough to make C++ completely unusable). See my earlier postings to
the gcc list and/or grep for PCC_STATIC_STRUCT_RETURN in cp/semantics.c.

-- 
Michael Sokolov
Public Service Agent
International Engineering and Science Task Force

1351 VINE AVE APT 27		Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA	(home office)

E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]