Re: -fwrapv enables some optimizations

2006-12-20 Thread Robert Dewar
Geert Bosch wrote: This is completely wrong. Making operations undefined is a two-edged sword. At the one hand, you can make more assumptions, but there's also the issue that when you want to rewrite expressions, you have to be more careful to not introduce undefined behavior when there was none

Re: -fwrapv enables some optimizations

2006-12-20 Thread Geert Bosch
On Dec 20, 2006, at 09:38, Bruno Haible wrote: But the other way around? Without -fwrapv the compiler can assume more about the program being compiled (namely that signed integer overflows don't occur), and therefore has more freedom for optimizations. All optimizations that are possible with -f

Re: -fwrapv enables some optimizations

2006-12-20 Thread Tom Tromey
> "Paolo" == Paolo Bonzini <[EMAIL PROTECTED]> writes: >> On Wed, Dec 20, 2006 at 03:50:23PM +, Joseph S. Myers wrote: >> For signed integers, overflow is undefined, but for unsigned integers, >> overflow wraps. Paolo> You mean writing the hypothetical PLUS_WRAP_EXPR (where a and b Paolo

Re: -fwrapv enables some optimizations

2006-12-20 Thread Paolo Bonzini
On Wed, Dec 20, 2006 at 03:50:23PM +, Joseph S. Myers wrote: Indeed. Fixing this may require it to be possible to mark individual operations with their overflow semantics (which will also be needed for LTO to handling inlining between translation units compiled with different options).

Re: -fwrapv enables some optimizations

2006-12-20 Thread Joe Buck
On Wed, 20 Dec 2006, Bruno Haible wrote: > > But the other way around? Without -fwrapv the compiler can assume more > > about the program being compiled (namely that signed integer overflows > > don't occur), and therefore has more freedom for optimizations. All > > optimizations that are possible

Re: -fwrapv enables some optimizations

2006-12-20 Thread Joseph S. Myers
On Wed, 20 Dec 2006, Bruno Haible wrote: > But the other way around? Without -fwrapv the compiler can assume more > about the program being compiled (namely that signed integer overflows > don't occur), and therefore has more freedom for optimizations. All > optimizations that are possible with -f

-fwrapv enables some optimizations

2006-12-20 Thread Bruno Haible
Hi, The gcc docs say: `-fwrapv' ... This flag enables some optimizations and disables others. -fwrapv turns some undefined behaviour (according to C99) into well-defined behaviour, therefore it is obvious that it can disable some optimizations. But the other way around? Without -fwrapv t