(int_fits_type_p): Negative ints never fit unsigned types, and

unsigned ints with top-bit-set never fit signed types.

From-SVN: r14637
This commit is contained in:
Richard Kenner 1997-08-02 18:50:39 -04:00
parent 272e2587a2
commit ae0a3dfbf4
1 changed files with 8 additions and 2 deletions

View File

@ -4346,12 +4346,18 @@ int_fits_type_p (c, type)
return (! (TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
&& INT_CST_LT_UNSIGNED (TYPE_MAX_VALUE (type), c))
&& ! (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
&& INT_CST_LT_UNSIGNED (c, TYPE_MIN_VALUE (type))));
&& INT_CST_LT_UNSIGNED (c, TYPE_MIN_VALUE (type)))
/* Negative ints never fit unsigned types. */
&& ! (TREE_INT_CST_HIGH (c) < 0
&& ! TREE_UNSIGNED (TREE_TYPE (c))));
else
return (! (TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
&& INT_CST_LT (TYPE_MAX_VALUE (type), c))
&& ! (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
&& INT_CST_LT (c, TYPE_MIN_VALUE (type))));
&& INT_CST_LT (c, TYPE_MIN_VALUE (type)))
/* Unsigned ints with top bit set never fit signed types. */
&& ! (TREE_INT_CST_HIGH (c) < 0
&& TREE_UNSIGNED (TREE_TYPE (c))));
}
/* Return the innermost context enclosing DECL that is