This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug middle-end/28831] [4.1/4.2/4.3/4.4 Regression] Aggregate copy not elided when using a return value as a pass-by-value parameter



------- Comment #5 from jason at gcc dot gnu dot org  2008-06-25 21:49 -------
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).


-- 


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


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