https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104526

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
+  tree type = TREE_TYPE (TREE_OPERAND (cond, 0));
+  if (type != TREE_TYPE (TREE_OPERAND (cond, 1)))
+    return false;
looks unnecessarily restrictive.
What tree-cfg.cc verification guarantees (and no need to check it in the
ranger)
is what verify_gimple_comparison verifies, i.e. that
  /* For comparisons we do not have the operations type as the
     effective type the comparison is carried out in.  Instead
     we require that either the first operand is trivially
     convertible into the second, or the other way around.  */
  if (!useless_type_conversion_p (op0_type, op1_type)
      && !useless_type_conversion_p (op1_type, op0_type))
I think the ranger has to be prepared for non-pointer-equal type mismatches as
long as they are useless_type_conversion_p compatible, that can happen anywhere
in the IL, including even cases like different but useless_type_conversion_p
compatible types of binary operators like +, -, * etc.
So I'd just remove the
  if (type != TREE_TYPE (TREE_OPERAND (cond, 1)))
    return false;
lines.

Reply via email to