This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[wide-int] Use MAX_MODE_INT rather than mode_for_size


"mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0)" isn't safe
because the widest mode might not have an integer counterpart.
We can get the widest integer mode directly using MAX_MODE_INT.

Tested on powerpc64-linux-gnu and by rerunning the assembly comparison.
OK to install?

Thanks,
Richard


Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c	2013-11-09 09:39:28.925815686 +0000
+++ gcc/simplify-rtx.c	2013-11-09 09:39:29.461819309 +0000
@@ -1619,7 +1619,7 @@ simplify_const_unary_operation (enum rtx
 	     a dangerous assumption as many times CONST_INTs are
 	     created and used with garbage in the bits outside of the
 	     precision of the implied mode of the const_int.  */
-	  op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0);
+	  op_mode = MAX_MODE_INT;
 	}
 
       real_from_integer (&d, mode, std::make_pair (op, op_mode), SIGNED);
@@ -1637,7 +1637,7 @@ simplify_const_unary_operation (enum rtx
 	     a dangerous assumption as many times CONST_INTs are
 	     created and used with garbage in the bits outside of the
 	     precision of the implied mode of the const_int.  */
-	  op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0);
+	  op_mode = MAX_MODE_INT;
 	}
 
       real_from_integer (&d, mode, std::make_pair (op, op_mode), UNSIGNED);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]