http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57361
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-05-22 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Assignment expansion makes this optimization: /* Optimize away no-op moves without side-effects. */ if (operand_equal_p (to, from, 0)) return; The operand_equal_p implementation looks safe at the moment (even in terms of type-based aliasing rules). I'd have done a more aggressive optimization in DSE, doing if (stmt_kills_ref_p (stmt, gimple_assign_rhs1 (stmt))) ... must be a self-assignment ... which would definitely need extra care for self-assignments that change the effective type of a memory location. Though I have a hard time creating a testcase that would exhibit sth like MEM[(struct X *)q_1] = MEM[(struct Y *)q_1]; which would change the dynamic type of *q_1 to X from Y.