aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-09-15 21:37:22 +0000
committerRichard Stallman <rms@gnu.org>1992-09-15 21:37:22 +0000
commitdcffa15b6e524634316ad09aab3f20869ad05f6e (patch)
treebbe1c73c187ddf80a05443fa3b49cc4999fc8bff /gcc/tree.c
parente837539976653dbbdca9d1b94c0595c20dbc9a0e (diff)
downloadgcc-dcffa15b6e524634316ad09aab3f20869ad05f6e.zip
gcc-dcffa15b6e524634316ad09aab3f20869ad05f6e.tar.gz
gcc-dcffa15b6e524634316ad09aab3f20869ad05f6e.tar.bz2
(int_fits_type_p): Negative ints never fit unsigned
types, and unsigned ints with top-bit-set never fit signed types. From-SVN: r2126
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 34de0d6..4fb48e6 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3131,10 +3131,12 @@ int_fits_type_p (c, type)
{
if (TREE_UNSIGNED (type))
return (!INT_CST_LT_UNSIGNED (TYPE_MAX_VALUE (type), c)
- && !INT_CST_LT_UNSIGNED (c, TYPE_MIN_VALUE (type)));
+ && !INT_CST_LT_UNSIGNED (c, TYPE_MIN_VALUE (type))
+ && (TREE_INT_CST_HIGH (c) >= 0 || TREE_UNSIGNED (TREE_TYPE (c))));
else
return (!INT_CST_LT (TYPE_MAX_VALUE (type), c)
- && !INT_CST_LT (c, TYPE_MIN_VALUE (type)));
+ && !INT_CST_LT (c, TYPE_MIN_VALUE (type))
+ && (TREE_INT_CST_HIGH (c) >= 0 || !TREE_UNSIGNED (TREE_TYPE (c))));
}
/* Return the innermost context enclosing DECL that is