From af9c6659665205581486c03daf470d17ead42d0f Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Sat, 14 Aug 2004 17:54:36 +0000 Subject: [PATCH] * c-common.c (shorten_compare): Use force_fit_type directly. From-SVN: r86004 --- gcc/ChangeLog | 6 +++++- gcc/c-common.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47693578669..6465583cfa3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2004-08-14 Nathan Sidwell + + * c-common.c (shorten_compare): Use force_fit_type directly. + 2004-08-14 Gerald Pfeifer Dimitri Papadopoulos-Orfanos Dave Korn @@ -1457,7 +1461,7 @@ * config/i386/xmmintrin.h: Include . 2004-08-03 H.J. Lu - Tanguy Fautrà + Tanguy Fautrà * config/i386/pmm_malloc.h: New file. diff --git a/gcc/c-common.c b/gcc/c-common.c index 09373dd05d8..1416871cdac 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1997,10 +1997,14 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, if (TREE_TYPE (primop1) != *restype_ptr) { - tree tmp = convert (*restype_ptr, primop1); - TREE_OVERFLOW (tmp) = TREE_OVERFLOW (primop1); - TREE_CONSTANT_OVERFLOW (tmp) = TREE_CONSTANT_OVERFLOW (primop1); - primop1 = tmp; + /* Convert primop1 to target type, but do not introduce + additional overflow. We know primop1 is an int_cst. */ + tree tmp = build_int_2 (TREE_INT_CST_LOW (primop1), + TREE_INT_CST_HIGH (primop1)); + + TREE_TYPE (tmp) = *restype_ptr; + primop1 = force_fit_type (tmp, 0, TREE_OVERFLOW (primop1), + TREE_CONSTANT_OVERFLOW (primop1)); } if (type != *restype_ptr) { -- 2.30.2