"Bingfeng Mei" <b...@broadcom.com> writes:

> Then how do I tell compiler that "a" is not aliased if I have to use global 
> variable? 
>
>> 
>> > Thanks,
>> > Bingfeng Mei
>> >
>> > int a;
>> > int P[100];
>> > void foo (int * restrict p)
>> > {
>> >  P[0] = *p;
>> >  a++;
>> >  P[1] = *p;
>> >  a++;
>> >  P[2] = *p;
>> >  a++;
>> > }

How about

int a;
int P[100];
void foo (int * restrict p)
{
  foo1 (p, P, &a);
}
void foo1 (int * restrict p, int * restrict pp, int * restrict pa)
{
  pp[0] = *p;
  a++;
  pp[1] = *p;
  a++;
  pp[2] = *p;
  a++;
}

Ian

Reply via email to