http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53085
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-24
13:13:26 UTC ---
Patch that applies to all maintained branches (the bug is also in 4.5!)
Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c (revision 186760)
+++ gcc/tree-ssa-pre.c (working copy)
@@ -4409,6 +4409,7 @@ eliminate (void)
has the same value number as its rhs. If so, the store is
dead. */
else if (gimple_assign_single_p (stmt)
+ && !gimple_has_volatile_ops (stmt)
&& !is_gimple_reg (gimple_assign_lhs (stmt))
&& (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs)))