This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [rfa:ppc] Fix PPC/NBSD struct return; Was: userdef.exp regression for ppc?
On Sun, Jun 02, 2002 at 12:39:00PM -0700, Jason R Thorpe wrote:
> Yes, that's what I'm saying :-) I didn't realize it at first, either,
> because the RETURN_IN_MEMORY() macro in the native 2.9x matches the AIX
> convention.
>
> The difference is that NetBSD's native 2.9x defaults to
> -fno-pcc-struct-return (which has the side-effect of giving the
> SVR4 semantics) whereas 3.1 and -current default to -fpcc-struct-return.
Uh, no, they don't. rs6000/rs6000.h:
#define RETURN_IN_MEMORY(TYPE) \
(AGGREGATE_TYPE_P (TYPE) && \
(TARGET_AIX_STRUCT_RET || \
(unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 8))
/* DRAFT_V4_STRUCT_RET defaults off. */
#define DRAFT_V4_STRUCT_RET 0
/* Let RETURN_IN_MEMORY control what happens. */
#define DEFAULT_PCC_STRUCT_RETURN 0
But I see how you got confused. There is a nasty gotcha in this area
of target configuration. If you have any kind of nontrivial
RETURN_IN_MEMORY macro, you *have* to define DEFAULT_PCC_STRUCT_RETURN
to 0, because the effect of flag_pcc_struct_return is to override
RETURN_IN_MEMORY and force all aggregates to be returned in memory.
flag_pcc_struct_return is a hangover from a time when (a) PCC was
relevant, and (b) GCC seems to have had a brain-dead policy of
ignoring the system ABI when it didn't like it. It should either go
away entirely, or be looked at only by the default RETURN_IN_MEMORY
macro.
zw