Re: An optimization question

2009-05-08 Thread Andrew Haley
Dave Korn wrote: > Andrew Haley wrote: >> Dave Korn wrote: > >>> So, this is a real bug then - but it's a missed optimisation in the first >>> case, not a bogus one in the second case? >> Probably, but it's not a very interesting one. For what it's worth, the >> tree dumps are identical right u

Re: An optimization question

2009-05-08 Thread Dave Korn
Andrew Haley wrote: > Dave Korn wrote: >> So, this is a real bug then - but it's a missed optimisation in the first >> case, not a bogus one in the second case? > > Probably, but it's not a very interesting one. For what it's worth, the > tree dumps are identical right up to the very last tree

Re: An optimization question

2009-05-08 Thread Andrew Haley
Dave Korn wrote: > Andrew Haley wrote: >> eCos@ wrote: > >>> === >>> int *p; >>> >>> int main(void) >>> { >>> p++; >>> __asm__ __volatile__ (""::); >>> p++; >>> } >>> === > >>> assembly

Re: An optimization question

2009-05-07 Thread Richard Guenther
On Thu, May 7, 2009 at 3:05 PM, Andrew Haley wrote: > Dave Korn wrote: >> Andrew Haley wrote: >>> eCos@ wrote: >> === int *p; int main(void) {         p++;         __asm__ __volatile__ (""::);         p++; } >

Re: An optimization question

2009-05-07 Thread Andrew Haley
Dave Korn wrote: > Andrew Haley wrote: >> eCos@ wrote: > >>> === >>> int *p; >>> >>> int main(void) >>> { >>> p++; >>> __asm__ __volatile__ (""::); >>> p++; >>> } >>> === > >>> assembly

Re: An optimization question

2009-05-07 Thread Dave Korn
Andrew Haley wrote: > eCos@ wrote: >> === >> int *p; >> >> int main(void) >> { >> p++; >> __asm__ __volatile__ (""::); >> p++; >> } >> === >> assembly code is like: >> 'addl $4, %eax'

Re: An optimization question

2009-05-07 Thread Andrew Haley
e...@sunnorth.com.cn wrote: > Here is an optimization question about gcc compiler, we wonder whether it > is a bug or not. > > A simple test program here: > === > int *p; > > int main(void) > { > p++; > __asm__ __volatile__ (""::); >