This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A patch for egcs 1.0.3/1.1
- To: egcs-patches at cygnus dot com
- Subject: A patch for egcs 1.0.3/1.1
- From: hjl at lucon dot org (H.J. Lu)
- Date: Tue, 16 Jun 1998 14:39:56 -0700 (PDT)
Hi,
Here is a patch for egcs 1.0.3/1.1.
# gcc -O byte.c
# a.out
zsh: 10914 abort ./a.out
--
H.J. Lu (hjl@gnu.org)
----
void foo (unsigned int * p)
{
if ((signed char)(*p & 0xFF) == 17 || (signed char)(*p & 0xFF) == 18)
return;
else
abort ();
}
int main ()
{
int i = 0x30011;
foo(&i);
return 0;
}
----
Tue Jun 16 07:32:50 1998 H.J. Lu (hjl@gnu.org)
* fold-const.c (make_range): Don't convert a narrower type to
wider type.
--- ../../../import/egcs/gcc/fold-const.c Fri Nov 14 06:29:58 1997
+++ ./fold-const.c Tue Jun 16 13:37:31 1998
@@ -2723,6 +2723,7 @@ make_range (exp, pin_p, plow, phigh)
{
enum tree_code code;
tree arg0, arg1, type;
+ tree orig_type = NULL_TREE;
int in_p, n_in_p;
tree low, high, n_low, n_high;
@@ -2858,6 +2859,12 @@ make_range (exp, pin_p, plow, phigh)
continue;
case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR:
+ if (orig_type == NULL_TREE)
+ orig_type = type;
+ if (GET_MODE_SIZE (TYPE_MODE (type))
+ > GET_MODE_SIZE (TYPE_MODE (orig_type)))
+ break;
+
if (! INTEGRAL_TYPE_P (type)
|| (low != 0 && ! int_fits_type_p (low, type))
|| (high != 0 && ! int_fits_type_p (high, type)))