This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C patch] Use force_fit_type directly
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Thu, 05 Aug 2004 12:45:50 +0100
- Subject: [C patch] Use force_fit_type directly
- Organization: Codesourcery LLC
This patch uses force_fit_type rather than convert, when we know we're
converting an int_cst. This means we don't have to muck about with
the overflow flags here anymore.
booted & tested on i686-pc-linux-gnu, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2004-08-05 Nathan Sidwell <nathan@codesourcery.com>
* c-common.c (shorten_compare): Use force_fit_type directly.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.547
diff -c -3 -p -r1.547 c-common.c
*** c-common.c 5 Aug 2004 05:51:50 -0000 1.547
--- c-common.c 5 Aug 2004 11:12:12 -0000
*************** shorten_compare (tree *op0_ptr, tree *op
*** 1997,2006 ****
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;
}
if (type != *restype_ptr)
{
--- 1997,2010 ----
if (TREE_TYPE (primop1) != *restype_ptr)
{
! /* 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)
{