(all_ones_mask_p): Really use tmask.
authorRichard Stallman <rms@gnu.org>
Wed, 24 Feb 1993 06:43:37 +0000 (06:43 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 24 Feb 1993 06:43:37 +0000 (06:43 +0000)
(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

index 4708f884295785883ce6e45a2cc269af9a432328..e659a3669dd5a8a57ff52df0a270f2f8ed0b95ea 100644 (file)
@@ -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);