------- Comment #8 from jakub at gcc dot gnu dot org 2010-08-30 14:05 ------- The other issue comes from MEM_ATTRS caching. mem_attrs_htab_eq considers MEM_EXPR to be equal if: 279 && (p->expr == q->expr 280 || (p->expr != NULL_TREE && q->expr != NULL_TREE 281 && operand_equal_p (p->expr, q->expr, 0))));
With -g there happens to be a different MEM_ATTRS in the cache than without -g, and as both are operand_equal_p, gcc doesn't care which one it chooses. As -fcompare-debug does a textual comparison, I guess we'd for -fdump-final-insns need to dump something that is stable. E.g. it could print just iterative_hash_expr (MEM_EXPR (memref), 0) instead of printing the expression. I'm not sure whether that would fix this completely, because I believe if there are collisions, mem_attrs_htab_eq could return true even if mem_attrs_htab_hash is different. Therefore perhaps mem_attrs_htab_eq should also check (size_t) iterative_hash_expr (p->expr, 0) == (size_t) iterative_hash_expr (q->expr, 0) if operand_equal_p returned true. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45419