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]

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


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.

Attachment: fixcomplexandoreqzero.diff.txt
Description: Text document


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