This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fix pr23128 (take X)
- From: Diego Novillo <dnovillo at redhat dot com>
- To: "James A. Morrison" <ja2morri at csclub dot uwaterloo dot ca>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 Aug 2005 08:51:13 -0400
- Subject: Re: [patch] fix pr23128 (take X)
- References: <kfhwtn2tkrn.fsf@csclub.uwaterloo.ca>
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.