This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is this correct behaviour?
"Bingfeng Mei" <bmei@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