Hi, as discussed earlier, the types_compatible_p in operand_equal_p seems redundant. (it is callers work to figure out how much of type matching it wants. If not, we probably want to treat most of other references and casts simlar way).
Bootstrapped/regtested x86_64-linux. OK? * fold-const.c (operand_equal_p): Drop types_compatible_p when comparing references. Index: fold-const.c =================================================================== --- fold-const.c (revision 229278) +++ fold-const.c (working copy) @@ -2982,9 +2982,6 @@ operand_equal_p (const_tree arg0, const_ TYPE_SIZE (TREE_TYPE (arg1)), flags))) return 0; - /* Verify that access happens in similar types. */ - if (!types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) - return 0; /* Verify that accesses are TBAA compatible. */ if (flag_strict_aliasing && (!alias_ptr_types_compatible_p