https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117805
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc
index 7480c07640e..69786661a78 100644
--- a/gcc/tree-complex.cc
+++ b/gcc/tree-complex.cc
@@ -127,7 +127,8 @@ some_nonzerop (tree t)
/* Operations with real or imaginary part of a complex number zero
cannot be treated the same as operations with a real or imaginary
operand if we care about the signs of zeros in the result. */
- if (TREE_CODE (t) == REAL_CST && !flag_signed_zeros)
+ if (TREE_CODE (t) == REAL_CST
+ && (!flag_signed_zeros || flag_complex_method < 2))
zerop = real_identical (&TREE_REAL_CST (t), &dconst0);
else if (TREE_CODE (t) == FIXED_CST)
zerop = fixed_zerop (t);
does this for the purpose of optimizing zero component imag/real complex
ops.