[PATCH] Fix middle-end/35429 ICE with complex arithmetic and && or || with comparision to zero

Andrew Pinski pinskia@gmail.com
Wed Mar 26 18:10:00 GMT 2008


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.

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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixcomplexandoreqzero.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080326/ad0397d5/attachment.txt>


More information about the Gcc-patches mailing list