Re: O2 and Overflow

2010-04-23 Thread Heinz Riener
On 04/23/2010 07:35 PM, Andrew Pinski wrote: Sent from my iPhone On Apr 23, 2010, at 10:25 AM, Heinz Riener wrote: [...] Signed interger overflow is undefined. Use -fwrapv or -fno-strict-overflow if you want gcc to behave as signed interger overflow being defined. Yes, that's what I wa

Re: O2 and Overflow

2010-04-23 Thread Manuel López-Ibáñez
I added this question to the FAQ: http://gcc.gnu.org/wiki/FAQ#signed_overflow Feel free to improve the answer for the future. Cheers, Manuel. On 23 April 2010 19:35, Andrew Pinski wrote: > > > Sent from my iPhone > > On Apr 23, 2010, at 10:25 AM, Heinz Riener > wrote: > >> Dear all, >> >> I'

Re: O2 and Overflow

2010-04-23 Thread Andrew Pinski
Sent from my iPhone On Apr 23, 2010, at 10:25 AM, Heinz Riener wrote: Dear all, I'm using the native GCC version[1] of my GNU/Linux distribution. I wonder whether GCC's optimization behavior is in the following case correct. Consider the following two programs: (1) int test(int n

Re: O2 and Overflow

2010-04-23 Thread Kai Tietz
2010/4/23 Heinz Riener : > Dear all, > > I'm using the native GCC version[1] of my GNU/Linux distribution.  I wonder > whether GCC's optimization behavior is in the following case correct. >  Consider the following two programs: > > (1) > int test(int n) { >  if (n > 0) >    return 1; >  return 0;

O2 and Overflow

2010-04-23 Thread Heinz Riener
Dear all, I'm using the native GCC version[1] of my GNU/Linux distribution. I wonder whether GCC's optimization behavior is in the following case correct. Consider the following two programs: (1) int test(int n) { if (n > 0) return 1; return 0; } (2) int test(int n) { if (2*n > 0