ISO Aliasing rules question
law@redhat.com
law@redhat.com
Fri Feb 21 19:38:00 GMT 2003
In message <75590000.1045854544@warlock.codesourcery.com>, Mark Mitchell writes
:
>
>
>--On Friday, February 21, 2003 10:16:02 AM -0700 "law@redhat.com"
><law@redhat.com> wrote:
>
>> Is this correct? Or is my recollection of the ISO standard incorrect
>> here?
>
>This is tricky. In general, you're right -- the structure of the type
>doesn't matter, only the name.
>
>But, then there's the "common initial sequence" stuff -- which doesn't
>apply in your example, but can in other palces. See 6.5.2.3 in your C99
>standard for details.
Understood. However, those cases are caught by the subset/superset
relationships we build in alias.c.
In the testcase I showed we effectively have the following alias sets
struct s1 struct s2
| |
double double
s1 is not a superset of s2 and s2 is not a superset of s2. Thus according
to our alias code objects of type s1 and type s2 will never conflict, even
though they have members of the same type.
Anyway, I'm just trying to make sure that
a. I understand this case correctly.
b. Our aliasing code does the right thing.
c. Our testsuite doesn't have tests with undefined behavior :-)
(that test is execute/20000603-1.c).
>Bottom line: the optimization in the code you showed is correct.
Meaning that execute/20000603-1.c is a bogus test :-)
jeff
More information about the Gcc
mailing list