https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63679
--- Comment #37 from alalaw01 at gcc dot gnu.org --- Hmmm, no it's not the hashing - that pretty much ignores all types. It's the comparison in hashable_expr_equal_p, which just uses operand_equal_p, specifically this part (in fold-const.c): case MEM_REF: /* Require equal access sizes, and similar pointer types. We can have incomplete types for array references of variable-sized arrays from the Fortran frontend though. Also verify the types are compatible. */ if (!((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1)) || (TYPE_SIZE (TREE_TYPE (arg0)) && TYPE_SIZE (TREE_TYPE (arg1)) && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)), TYPE_SIZE (TREE_TYPE (arg1)), flags))) && types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1)) && ((flags & OEP_ADDRESS_OF) || (alias_ptr_types_compatible_p (TREE_TYPE (TREE_OPERAND (arg0, 1)), TREE_TYPE (TREE_OPERAND (arg1, 1))) && (MR_DEPENDENCE_CLIQUE (arg0) == MR_DEPENDENCE_CLIQUE (arg1)) && (MR_DEPENDENCE_BASE (arg0) == MR_DEPENDENCE_BASE (arg1)) && (TYPE_ALIGN (TREE_TYPE (arg0)) == TYPE_ALIGN (TREE_TYPE (arg1))))))) specifically, a pointer to int, and a pointer to an array of int, are not alias_ptr_types_compatible_p. (I'm not clear that they should be, either!?)