This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Structure Return Testcase
- To: jsm28 at cam dot ac dot uk
- Subject: Re: Structure Return Testcase
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 15 Mar 2001 12:13:18 -0800
- Cc: law at redhat dot com, rth at redhat dot com, gcc at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <Pine.LNX.4.32.0103151901200.20427-100000@kern.srcf.societies.cam.ac.uk>
>>>>> "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;
just to be safe -- or else you have to know that you need to use
memmove for some assignments.
I see that the history of this was that Paul Eggert (and RMS) made
essentially this argument -- but lost.
I bet we get this wrong using both the old RTL-based inliner and the new
tree-based inliner, even if we get it right when not inlining...
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com