------- Comment #7 from rguenther at suse dot de  2008-08-27 09:40 -------
Subject: Re:  missed FRE opportunity because of
 signedness of addition

On Wed, 27 Aug 2008, bonzini at gnu dot org wrote:

> 
> 
> ------- Comment #4 from bonzini at gnu dot org  2008-08-27 06:41 -------
> Minimized testcase:
> 
> int m(int *y, int x)
> {
>   int a = y[x + 1];
>   int b = y[++x];
>   return a - b;
> }
> 
> should be optimized to "return 0"

Because fold folds (unsigned)(x + 1) to (unsigned)x + 1 but doesn't
touch (unsigned) ++x which gets gimplified to a signed addition.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242

Reply via email to