Re: Is this correct behaviour?

2011-09-06 Thread Ian Lance Taylor
"Bingfeng Mei" 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

RE: Is this correct behaviour?

2011-09-06 Thread Bingfeng Mei
> -Original Message- > From: Richard Guenther [mailto:richard.guent...@gmail.com] > Sent: 06 September 2011 16:42 > To: Bingfeng Mei > Cc: gcc@gcc.gnu.org > Subject: Re: Is this correct behaviour? > > On Tue, Sep 6, 2011 at 5:30 PM, Bingfeng Mei wrote: &

Re: Is this correct behaviour?

2011-09-06 Thread Richard Guenther
On Tue, Sep 6, 2011 at 5:30 PM, Bingfeng Mei wrote: > Hi, > I compile the following code with arm gcc 4.6 (x86 is the similar with one of > 4.7 snapshot). > I noticed "a" is written to memory three times instead of being added by 3 > and written at the > end. Doesn't restrict guarantee "a" won't