This is the mail archive of the gcc@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]

Re: Structure Return Testcase


>>>>> "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


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