This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Aliasing sets on Arrays Types
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc mailing list <gcc at gcc dot gnu dot org>
- Cc: Daniel Berlin <dberlin at dberlin dot org>
- Date: Tue, 21 Mar 2006 01:18:37 -0500
- Subject: Aliasing sets on Arrays Types
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?
In NumSift, shouldn't the store to (*a1)[0] interfere with (*a)[0] so
that we
don't return 0 always?
Here is a full testcase for testing (I don't get any warnings with -W
-Wall -pedantic):
typedef long atype[];
typedef long atype1[];
int NumSift (atype *a, atype1 *a1)
{
(*a)[0] = 0;
(*a1)[0] = 1;
return (*a)[0];
}
int main(void)
{
long a[2];
if (!NumSift(&a, &a))
__builtin_abort ();
return 0;
}
And this is a regression from 3.4.0 if this is a bug.
Also note this was generated from looking at Daniel Berlin's Array
Reference
for Pointers patch.
Thanks,
Andrew Pinski