This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Aliasing sets on Arrays Types
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Andrew Pinski" <pinskia at physics dot uc dot edu>
- Cc: "gcc mailing list" <gcc at gcc dot gnu dot org>, "Daniel Berlin" <dberlin at dberlin dot org>
- Date: Tue, 21 Mar 2006 14:43:22 +0100
- Subject: Re: Aliasing sets on Arrays Types
- References: <654e08c7a5f40915bb25a3dc7cbfb5ab@physics.uc.edu>
On 3/21/06, Andrew Pinski <pinskia@physics.uc.edu> 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." And continues
with an example
After the declarations
typedef struct s1 { int x; } t1, *tp1;
typedef struct s2 { int x; } t2, *tp2;
type t1 and the type pointed to by tp1 are compatible. Type t1 is also
compatible with type struct
s1, but not compatible with the types struct s2, t2, the type pointed
to by tp2, or int.
where it explicitly says sth about structures, but not array types.
Richard.