This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/72835] [7 Regression] Incorrect arithmetic optimization involving bitfield arguments
- From: "kugan at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Aug 2016 13:14:54 +0000
- Subject: [Bug tree-optimization/72835] [7 Regression] Incorrect arithmetic optimization involving bitfield arguments
- Auto-submitted: auto-generated
- References: <bug-72835-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72835
--- 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.