This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix middle-end/35429 ICE with complex arithmetic and && or || with comparision to zero
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Andrew Pinski" <pinskia at gmail dot com>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Mar 2008 20:50:35 +0100
- Subject: Re: [PATCH] Fix middle-end/35429 ICE with complex arithmetic and && or || with comparision to zero
- References: <de8d50360803261022l57bf0079oe6466448b16561bb@mail.gmail.com>
On Wed, Mar 26, 2008 at 6:22 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
> The problem here is that fold uses integer_zerop to check if an
> equal or no equal expression is the integer zero but integer_zerop
> also returns true for complex integer zero. Even before Richard's
> patch to use build_int_cst, we were producing a BIT_IOR_EXPR of a
> complex integer type which does not make sense. This patch adds a
> check for integeral types for these two optimizations.
>
> OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
This is ok. (I never understood why we handle complex in integer_zerop...)
Thanks,
Richard.
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * fold-const.c (fold_truthop): Check for integeral types when folding
> a == 0 && b == 0 and
> a != 0 || b != 0 .
>
> * gcc.c-torture/compile/complex-5.c: New test.
>