This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28831] [4.0/4.1/4.2 Regression] Aggregate copy not elided when using a return value as a pass-by-value parameter
- From: "guillaume dot melquiond at ens-lyon dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2006 08:34:58 -0000
- Subject: [Bug middle-end/28831] [4.0/4.1/4.2 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 #3 from guillaume dot melquiond at ens-lyon dot fr 2006-08-25 08:34 -------
> Which looks ok if we are passing via value but since we need to pass by
> reference, the middle-end thinks we need a new stack space for it because it
> does not know that D.1992 is not used after the call to g.
Isn't it the other way around? There is no problem if we are passing by
reference, as the code then looks like "g (&D.1992);". The middle-end will not
do any copy. But, because we are passing by value, D.1992 is copied into the
stack frame instead. I understand your point about the middle-end having to
ensure that D.1992 is not used after g in order to store it directly into the
stack frame of g. But isn't this information already available to the
middle-end?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28831