From 13af526d4f317b9a8ac4cb1d3d66a6c160da6ca7 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Wed, 24 Feb 1993 06:43:37 +0000 Subject: [PATCH] (all_ones_mask_p): Really use tmask. (all_ones_mask_p): Declare tmask to be `tree'. (optimize_bit_field_compare) Add missing semicolon. (decode_field_reference): Use force_fit_type instead of convert to avoid truncated integer warning. (all_ones_mask_p): Likewise. From-SVN: r3519 --- gcc/fold-const.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4708f884295..e659a3669dd 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2294,7 +2294,10 @@ optimize_bit_field_compare (code, compare_type, lhs, rhs) #endif /* Make the mask to be used against the extracted field. */ - mask = convert (unsigned_type, build_int_2 (~0, ~0)); + mask = build_int_2 (~0, ~0); + TREE_TYPE (mask) = unsigned_type; + force_fit_type (mask); + mask = convert (unsigned_type, mask); mask = const_binop (LSHIFT_EXPR, mask, size_int (lnbitsize - lbitsize), 0); mask = const_binop (RSHIFT_EXPR, mask, size_int (lnbitsize - lbitsize - lbitpos), 0); @@ -2451,13 +2454,15 @@ all_ones_mask_p (mask, size) { tree type = TREE_TYPE (mask); int precision = TYPE_PRECISION (type); + tree tmask; + tmask = build_int_2 (~0, ~0); + TREE_TYPE (tmask) = signed_type (type); + force_fit_type (tmask); return operand_equal_p (mask, const_binop (RSHIFT_EXPR, - const_binop (LSHIFT_EXPR, - convert (signed_type (type), - build_int_2 (~0, ~0)), + const_binop (LSHIFT_EXPR, tmask, size_int (precision - size), 0), size_int (precision - size), 0), 0); -- 2.30.2