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]

Re: [patch] fix pr23128 (take X)


On Wed, Aug 03, 2005 at 11:59:24PM -0400, James A. Morrison wrote:

> @@ -915,12 +915,33 @@ vrp_int_const_binop (enum tree_code code
>       on -INF and +INF.  */
>    res = int_const_binop (code, val1, val2, 0);
>  
> +  if (TYPE_UNSIGNED (TREE_TYPE (val1)))
> +    {
> +      tree type = TREE_TYPE (val1);
> +      tree checkz = NULL_TREE;
> +
> +      if (code != PLUS_EXPR && code != MINUS_EXPR)
> +	return res;
> +
MULT_EXPR can also wrap around.

> +      if (code == PLUS_EXPR)
> +	checkz = fold_binary (GE_EXPR, type, res, val1);
> +      else if (code == MINUS_EXPR)
> +	checkz = fold_binary (LE_EXPR, type, res, val1);
> +
Better use compare_values here.


OK with those changes.


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