This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR 15777, Fold does not always fold sub trees
- From: Geoffrey Keating <geoffk at geoffk dot org>
- To: Andrew Pinski <apinski at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 06 Jul 2004 23:44:54 -0700
- Subject: Re: [PATCH] Fix PR 15777, Fold does not always fold sub trees
- References: <163B51DA-CFD3-11D8-96E5-00039351ED8A@apple.com>
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.