This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Structure Return Testcase
- To: rth at redhat dot com
- Subject: Structure Return Testcase
- From: Jeffrey A Law <law at redhat dot com>
- Date: Thu, 15 Mar 2001 09:42:08 -0700
- Cc: gcc at gcc dot gnu dot org
- Reply-To: law at redhat dot com
I've been talking with Mark Mitchell about execute/20010124-1.c and we believe
this test is invalid according to C/C++ standards.
If we look at the two statements that are producing structure returns
which trigger the overlapping memcpy we have:
union U u;
u.b.s = f(&u.a.s);
u.a.s = f(&u.b.s);
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.
Do you concur? Is there some other reason we need to keep that test?
[ FWIW, this is the last regression for the PA against gcc-2.95.2 in the
c-torture execution tests :-) ]
jeff