This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR 15777, Fold does not always fold sub trees


Andrew Pinski <apinski@apple.com> writes:

> I found this bug when I was playing around with my tree combiner
> which needs many improvements which I do not have time for right
> now.
> 
> Basically ((x&1) == 0) == 0 is folded to
> (int)((unsigned int)x ^ 1 ^ 1) & 1 when it should just fold it
> to be (x & 1) != 0 or (x & 1) depending on the resulting type.
> 
> So this patch makes fold, fold the new x ^ 1 expression which fixes
> this bug.
> 
> OK? Bootstrapped on powerpc-apple-darwin with no regression.
> 
> Thanks,
> Andrew Pinski
> 
> 
> 
> ChangeLog:
> 	* fold-const.c (fold_single_bit_test): Fold the x^1 expression.

This is OK.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]