+2018-08-25 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/87059
+ * builtins.c (expand_builtin_strncmp): Convert MIN_EXPR operand
+ to the same type as the other.
+ * fold-const.c (fold_binary_loc): Assert expectation.
+
2018-08-25 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin.c (machopic_legitimize_pic_address): Clean up
/* If we are not using the given length, we must incorporate it here.
The actual new length parameter will be MIN(len,arg3) in this case. */
if (len != len3)
- len = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (len), len, len3);
+ {
+ len = fold_convert_loc (loc, sizetype, len);
+ len = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (len), len, len3);
+ }
rtx arg1_rtx = get_memory_rtx (arg1, len);
rtx arg2_rtx = get_memory_rtx (arg2, len);
rtx arg3_rtx = expand_normal (len);
if (kind == tcc_comparison || code == MIN_EXPR || code == MAX_EXPR)
{
+ if (code == MIN_EXPR || code == MAX_EXPR)
+ {
+ tree typ0 = TREE_TYPE (arg0);
+ tree typ1 = TREE_TYPE (arg1);
+ gcc_assert (TYPE_SIGN (typ0) == TYPE_SIGN (typ1)
+ && TYPE_MODE (typ0) == TYPE_MODE (typ1));
+ }
+
STRIP_SIGN_NOPS (arg0);
STRIP_SIGN_NOPS (arg1);
}