------- Comment #2 from pinskia at gcc dot gnu dot org 2008-03-25 04:34 ------- Here is the patch which I am testing: Index: fold-const.c =================================================================== --- fold-const.c (revision 133503) +++ fold-const.c (working copy) @@ -5357,7 +5357,8 @@ fold_truthop (enum tree_code code, tree if (code == TRUTH_OR_EXPR && lcode == NE_EXPR && integer_zerop (lr_arg) && rcode == NE_EXPR && integer_zerop (rr_arg) - && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)) + && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg) + && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg))) return build2 (NE_EXPR, truth_type, build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg), ll_arg, rl_arg), @@ -5367,7 +5368,8 @@ fold_truthop (enum tree_code code, tree if (code == TRUTH_AND_EXPR && lcode == EQ_EXPR && integer_zerop (lr_arg) && rcode == EQ_EXPR && integer_zerop (rr_arg) - && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)) + && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg) + && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg))) return build2 (EQ_EXPR, truth_type, build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg), ll_arg, rl_arg), Index: testsuite/gcc.c-torture/compile/complex-5.c =================================================================== --- testsuite/gcc.c-torture/compile/complex-5.c (revision 0) +++ testsuite/gcc.c-torture/compile/complex-5.c (revision 0) @@ -0,0 +1,9 @@ +int foo(__complex__ int z0, __complex__ int z1) +{ + return z0 != 0 || z1 != 0; +} + +int foo1(__complex__ int z0, __complex__ int z1) +{ + return z0 == 0 && z1 == 0; +}
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35429