[Bug tree-optimization/72835] [7 Regression] Incorrect arithmetic optimization involving bitfield arguments

kugan at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 9 13:15:00 GMT 2016


--- Comment #4 from kugan at gcc dot gnu.org ---
Looks like it was a latent issue. In rewrite_expr_tree, when re-associate
operands, we should reset range_info for the LHS. We don’t do that now.
Following patch fixes the test case. 

diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7fd7550..6272d98 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3945,6 +3945,7 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
              gimple_assign_set_rhs1 (stmt, oe1->op);
              gimple_assign_set_rhs2 (stmt, oe2->op);
              update_stmt (stmt);
+             reset_flow_sensitive_info (lhs);

          if (rhs1 != oe1->op && rhs1 != oe2->op)

I think we also need to do the same in rewrite_expr_tree_parallel.

More information about the Gcc-bugs mailing list