@@ -0,0 +1,14 @@
+/* PR tree-optimization/71994 */
+/* { dg-do compile } */
+int om, h6;
+
+void eo (void)
+{
+ const int tl = 1;
+ int ln;
+
+ h6 = (om + tl) > 0;
+ ln = om && (om & h6);
+ h6 = om;
+ om = ln < h6;
+}
@@ -3636,7 +3636,9 @@ maybe_optimize_range_tests (gimple *stmt)
gcc_assert (bb == last_bb);
new_op = ops[bbinfo[idx].first_idx++]->op;
}
- if (bbinfo[idx].op != new_op)
+ if (bbinfo[idx].op != new_op
+ && types_compatible_p (TREE_TYPE (new_op),
+ TREE_TYPE (bbinfo[idx].op)))
{
imm_use_iterator iter;
use_operand_p use_p;