This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Structure Return Testcase
Mark Mitchell <mark@codesourcery.com> writes:
| >>>>> "Joseph" == Joseph S Myers <jsm28@cam.ac.uk> writes:
|
| Joseph> As I've previously noted, this is essentially the testcase
| Joseph> of DR#001, the example added to 6.6.6.4 of the old
| Joseph> standard by TC1, and the example of 6.8.6.4 paragraph 4 in
| Joseph> C99. Footnote 135 seems quite clear. "The return
| Joseph> statement is not an assignment. The overlap restriction
| Joseph> of subclause 6.5.16.1 does not apply to the case of
| Joseph> function return."
|
| Lovely.
|
| Yes, I concur.
|
| It is not-so-very-nice that it makes a difference whether you are
| calling a function or not, here; that means that you cannot, in
| general, turn:
|
| s a;
| s f() { return b; }
| a = f();
|
| into:
|
| a = b;
|
| since the latter case remains illegal.
|
| So, essentially, you have to do the inlining as:
|
| s temp;
| temp = b;
| a = temp;
However I would like us not to pessimize in the case of the Returned Value
Optimization as described in the C++ Standard (12.5). Yes, we don't
have it yet; but it is long-awaited optimization.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com