Re: GCC optimizes integer overflow: bug or feature?

2006-12-21 Thread Paul Brook
On Friday 22 December 2006 02:06, Robert Dewar wrote: > Paul Brook wrote: > > On Friday 22 December 2006 00:58, Denis Vlasenko wrote: > >> On Tuesday 19 December 2006 23:39, Denis Vlasenko wrote: > >>> There are a lot of 100.00% safe optimizations which gcc > &g

Re: GCC optimizes integer overflow: bug or feature?

2006-12-21 Thread Paul Brook
On Friday 22 December 2006 00:58, Denis Vlasenko wrote: > On Tuesday 19 December 2006 23:39, Denis Vlasenko wrote: > > There are a lot of 100.00% safe optimizations which gcc > > can do. Value range propagation for bitwise operations, for one > > Or this, absolutely typical C code. i386 arch can co

Re: GCC optimizes integer overflow: bug or feature?

2006-12-19 Thread Paul Brook
On Tuesday 19 December 2006 22:39, Denis Vlasenko wrote: > On Tuesday 19 December 2006 22:46, Paul Brook wrote: > > > Compiler can optimize it any way it wants, > > > as long as result is the same as unoptimized one. > > > > We have an option for that. It'

Re: GCC optimizes integer overflow: bug or feature?

2006-12-19 Thread Paul Brook
> Compiler can optimize it any way it wants, > as long as result is the same as unoptimized one. We have an option for that. It's called -O0. Pretty much all optimization will change the behavior of your program. The important distinction is whether that difference is observable in valid progra