This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Structure Return Testcase
- To: Jeffrey A Law <law at redhat dot com>
- Subject: Re: Structure Return Testcase
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Thu, 15 Mar 2001 19:07:18 +0000 (GMT)
- cc: <rth at redhat dot com>, <gcc at gcc dot gnu dot org>
On Thu, 15 Mar 2001, Jeffrey A Law wrote:
> According to the C standard (thanks Mark):
>
> If the value being stored in an object is accessed from another
> object that overlaps in any way the storage of the first object,
> then the overlap shall be exact and the two objects shall have
> qualified or unqualified versions of a compatible type; otherwise,
> the behavior is undefined.
>
>
> Given the definition of U we don't have an exact overlap between the lhs and
> rhs which violates the rule above, thus triggering undefined behavior.
As I've previously noted, this is essentially the testcase of DR#001, the
example added to 6.6.6.4 of the old standard by TC1, and the example of
6.8.6.4 paragraph 4 in C99. Footnote 135 seems quite clear. "The return
statement is not an assignment. The overlap restriction of subclause
6.5.16.1 does not apply to the case of function return."
--
Joseph S. Myers
jsm28@cam.ac.uk