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

Reply via email to