public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* question about TARGET_MUST_PASS_IN_STACK
@ 2009-06-03  3:35 DJ Delorie
  2009-06-03  7:04 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: DJ Delorie @ 2009-06-03  3:35 UTC (permalink / raw)
  To: gcc


On xstormy16, when structures with variable-length arrays are passed
to functions (execute/20020412-1.c), it appears that they're passed by
reference (based on examining the stack), despite the port not
explicitly requesting that.

This causes a mis-match in the va_arg code, which assumes the array is
passed by value, just pushed to the stack portion of the argument
list.

Which interpretation of these macros is correct?  (based on that, I'll
debug further)

Xstormy16 uses the default TARGET_MUST_PASS_IN_STACK, which returns
true only for variable-length arrays, and uses the default
TARGET_PASS_BY_REFERENCE, which always returns false.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about TARGET_MUST_PASS_IN_STACK
  2009-06-03  3:35 question about TARGET_MUST_PASS_IN_STACK DJ Delorie
@ 2009-06-03  7:04 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2009-06-03  7:04 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc

DJ Delorie <dj@redhat.com> writes:

> On xstormy16, when structures with variable-length arrays are passed
> to functions (execute/20020412-1.c), it appears that they're passed by
> reference (based on examining the stack), despite the port not
> explicitly requesting that.
>
> This causes a mis-match in the va_arg code, which assumes the array is
> passed by value, just pushed to the stack portion of the argument
> list.
>
> Which interpretation of these macros is correct?  (based on that, I'll
> debug further)
>
> Xstormy16 uses the default TARGET_MUST_PASS_IN_STACK, which returns
> true only for variable-length arrays, and uses the default
> TARGET_PASS_BY_REFERENCE, which always returns false.

See the function pass_by_reference in function.c.

      /* GCC post 3.4 passes *all* variable sized types by reference.  */

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-03  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03  3:35 question about TARGET_MUST_PASS_IN_STACK DJ Delorie
2009-06-03  7:04 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).