This is the mail archive of the 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]
Other format: [Raw text]

Re: Aliasing sets on Arrays Types

Richard Guenther writes:
 > On 3/21/06, Andrew Pinski <> wrote:
 > > Take the following C code:
 > > typedef long atype[];
 > > typedef long atype1[];
 > >
 > > int NumSift (atype *a, atype1 *a1)
 > > {
 > >    (*a)[0] = 0;
 > >    (*a1)[0] = 1;
 > >    return (*a)[0];
 > > }
 > > Shouldn't the aliasing set for the type atype be the same as atype1?
 > Im not entirely sure, but the C99 standard does at least not suggest
 > otherwise, instead it says (6.7.7/3) "A typedef declaration does not introduce
 > a new type, only a synonym for the type so specified."

atype and atype1 are compatible bacsue of, Array declarators:

6   For two array types to be compatible, both shall have compatible
    element types, and if both size specifiers are present, and are
    integer constant expressions, then both size specifiers shall have
    the same constant value. If the two array types are used in a
    context which requires them to be compatible, it is undefined
    behavior if the two size specifiers evaluate to unequal values.

I assume that compatible types should be in the same alias set.


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