@@ -1358,6 +1358,108 @@ force_fit_type (tree type, const wide_int_ref &cst,
return wide_int_to_tree (type, cst);
}
+bool binop_overflow (enum tree_code op, tree t1, tree t2, tree type)
+{
tree.c doesn't look like the best fit. I think putting it into
tree-vrp.c is better
and I think that extract_range_from_binary_expr_1 itself should compute what we
want here as additional output. Conservative handling for all but plus/minus is
ok with me.
+ if (t1 == NULL_TREE || t2 == NULL_TREE || type == NULL_TREE)
+ return true;
+
+ if (TYPE_OVERFLOW_UNDEFINED (type))
+ return false;
+
+ if (!INTEGRAL_TYPE_P (type))
+ return true;
note that we'll ICE if you call TYPE_OVERFLOW_UNDEFINED on a type
that is not ANY_INTEGRAL_TYPE_P, so better re-order the checks.
Thanks,
Richard.
> Regards
> Robin