http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28831

--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-12 
12:05:26 UTC ---
(In reply to comment #5)
> Here's another example:
> 
> struct A { int i[100]; };
> void f(struct A);
> int main()
> {
>   f((struct A){1});
> }
> 
> Here we build up the compound literal on the stack and then copy it into the
> argument slot.
> 
> This seems to be a problem with GIMPLE, as there's no way to represent that we
> want a particular temporary object to live in the argument slot.
> 
> This is both more and less of a problem for C++, as it has many more temporary
> struct objects, but also has pass-by-reference (and the ABI does transparent
> pass-by-reference for non-POD structs).

I suppose it would be easy to add a decl flag DECL_ARGUMENT_SLOT, but of course
defering its allocation until we expand the call (if the argument is passed
by value) is going to be interesting, as we basically have the argument
setup visible in gimple.  For your testcase it's passed by reference it
seems so that would be ok and we can simply avoid the argument slot
allocation and copying at expansion time.

Reply via email to