This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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
- From: "jason at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2008 21:49:37 -0000
- Subject: [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
- References: <bug-28831-7904@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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