https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116034

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the issue is in maybe_rewrite_mem_ref_base :
      else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
               && useless_type_conversion_p (TREE_TYPE (*tp),
                                             TREE_TYPE (TREE_TYPE (sym))))
        {
          *tp = build1 (integer_zerop (TREE_OPERAND (*tp, 1))
                        ? REALPART_EXPR : IMAGPART_EXPR,
                        TREE_TYPE (*tp), sym);
        }


It only checks for 0 and non-zero rather than 0 and size (of type) like it is
done in gimple-fold.cc and fold-const.cc.

Which means it has been latent since r0-107202-g64a3d6470e5eb7 and exposed by
something started to be optimized in GCC 7.

Reply via email to