diff options
author | Richard Stallman <rms@gnu.org> | 1992-09-15 21:37:22 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-09-15 21:37:22 +0000 |
commit | dcffa15b6e524634316ad09aab3f20869ad05f6e (patch) | |
tree | bbe1c73c187ddf80a05443fa3b49cc4999fc8bff /gcc/tree.c | |
parent | e837539976653dbbdca9d1b94c0595c20dbc9a0e (diff) | |
download | gcc-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |