diff options
author | Richard Henderson <rth@redhat.com> | 2002-04-25 19:15:52 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-04-25 19:15:52 -0700 |
commit | 5c5b22838958187f83bf60d0394cc06942796646 (patch) | |
tree | d191e51bd4b8889ad81bf2f13318123a238b62bb /gcc/c-common.c | |
parent | 28ce94d46b9b885cc01f1649bc545b6978e033d0 (diff) | |
download | gcc-5c5b22838958187f83bf60d0394cc06942796646.zip gcc-5c5b22838958187f83bf60d0394cc06942796646.tar.gz gcc-5c5b22838958187f83bf60d0394cc06942796646.tar.bz2 |
re PR c/2098 (compare with unsigned variable - no error reporting)
PR c/2098
* c-common.c (shorten_compare): Simplfy conditions leading to
the generation of a warning.
* gcc.dg/compare6.c: New.
From-SVN: r52778
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 03966a8..f9337df 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1999,19 +1999,8 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) type = c_common_unsigned_type (type); } - if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST) + if (TREE_CODE (primop0) != INTEGER_CST) { - /* This is the case of (char)x >?< 0x80, which people used to use - expecting old C compilers to change the 0x80 into -0x80. */ - if (val == boolean_false_node) - warning ("comparison is always false due to limited range of data type"); - if (val == boolean_true_node) - warning ("comparison is always true due to limited range of data type"); - } - - if (!min_lt && unsignedp0 && TREE_CODE (primop0) != INTEGER_CST) - { - /* This is the case of (unsigned char)x >?< -1 or < 0. */ if (val == boolean_false_node) warning ("comparison is always false due to limited range of data type"); if (val == boolean_true_node) |