diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6abce5924e9..a73b1e6a9ba 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4218,8 +4218,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, { if (value != 0 && !TREE_OVERFLOW (value)) { - low = fold_convert_loc (loc, sizetype, low); - low = fold_build1_loc (loc, NEGATE_EXPR, sizetype, low); + low = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (low), low); return build_range_check (loc, type, fold_build_pointer_plus_loc (loc, exp, low), 1, build_int_cst (etype, 0), value); @@ -7862,10 +7861,8 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) tree arg00 = TREE_OPERAND (arg0, 0); tree arg01 = TREE_OPERAND (arg0, 1); - return fold_build2_loc (loc, - TREE_CODE (arg0), type, - fold_convert_loc (loc, type, arg00), - fold_convert_loc (loc, sizetype, arg01)); + return fold_build_pointer_plus_loc + (loc, fold_convert_loc (loc, type, arg00), arg01); } /* Convert (T1)(~(T2)X) into ~(T1)X if T1 and T2 are integral types @@ -8446,6 +8443,7 @@ maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type, cst0, build_int_cst (TREE_TYPE (cst0), 1)); if (code0 != INTEGER_CST) t = fold_build2_loc (loc, code0, TREE_TYPE (arg0), TREE_OPERAND (arg0, 0), t); + t = fold_convert (TREE_TYPE (arg1), t); /* If swapping might yield to a more canonical form, do so. */ if (swap) @@ -8935,7 +8933,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, return fold_build2_loc (loc, cmp_code, type, variable1, const2); } - tem = maybe_canonicalize_comparison (loc, code, type, op0, op1); + tem = maybe_canonicalize_comparison (loc, code, type, arg0, arg1); if (tem) return tem; |