This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Structure Return Testcase
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: Structure Return Testcase
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Thu, 15 Mar 2001 23:40:46 +0000 (GMT)
- cc: <rth at redhat dot com>, <law at redhat dot com>, <gcc at gcc dot gnu dot org>
On Thu, 15 Mar 2001, Mark Mitchell wrote:
> Using memmove everywhere will get us correctness, with some perhaps
> sizable performance hit.
>
> We can't (in general) detect the overlap. You can do:
>
> u.s1.s = (*fp)()
>
> after all. So, we have to be conservative. If `u' is global or
> addressed, we'll always be conservative.
There are some cases that can obviously be optimised. For example, if the
return is from an auto variable in the returning function, or if the
assignment is to an auto variable in the calling function that doesn't
have its address taken. When inlining, both of these should be handled.
Where the ABI uses a pointer to where the return value is to be placed,
the ABI ought to specify whether avoiding problems in this case is the
responsibility of the caller (providing a pointer to a temporary - the
callee can freely memcpy from anywhere to the area provided) or the callee
(the area might alias any other object used by the callee). If the ABI
specification is unclear, the ABI maintainers should be asked to clarify
it.
--
Joseph S. Myers
jsm28@cam.ac.uk