diff options
author | Richard Stallman <rms@gnu.org> | 1993-10-31 20:19:31 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-10-31 20:19:31 +0000 |
commit | 94dccd9d27e6b682760440cc5693e7f049676ae1 (patch) | |
tree | 43562a24742295ea60d48a89553e59f1b65a520a | |
parent | 0c316b201f9ba9e2627615d8dc9860297fb7c8c8 (diff) | |
download | gcc-94dccd9d27e6b682760440cc5693e7f049676ae1.zip gcc-94dccd9d27e6b682760440cc5693e7f049676ae1.tar.gz gcc-94dccd9d27e6b682760440cc5693e7f049676ae1.tar.bz2 |
(shorten_compare): Undo previous change.
Instead, just suppress warnings if both args are constant.
From-SVN: r5957
-rw-r--r-- | gcc/c-common.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 37d0458..58c83a6 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1236,6 +1236,8 @@ binary_op_error (code) /* Subroutine of build_binary_op, used for comparison operations. See if the operands have both been converted from subword integer types and, if so, perhaps change them both back to their original type. + This function is also responsible for converting the two operands + to the proper common type for comparison. The arguments of this function are all pointers to local variables of build_binary_op: OP0_PTR is &OP0, OP1_PTR is &OP1, @@ -1259,13 +1261,6 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) tree primop0, primop1; enum tree_code code = *rescode_ptr; - /* Don't do anything if both args are constant. - This avoids confusing warnings. The caller will fold properly. */ - if ((TREE_CODE (op0) == INTEGER_CST || TREE_CODE (op0) == REAL_CST) - && - (TREE_CODE (op1) == INTEGER_CST || TREE_CODE (op1) == REAL_CST)) - return 0; - /* Throw away any conversions to wider types already present in the operands. */ @@ -1452,7 +1447,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) type = unsigned_type (type); } - if (!max_gt && !unsignedp0) + if (!max_gt && !unsignedp0 && TREE_CODE (primop1) != 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. */ @@ -1462,7 +1457,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) warning ("comparison is always 1 due to limited range of data type"); } - if (!min_lt && unsignedp0) + if (!min_lt && unsignedp0 && TREE_CODE (primop1) != INTEGER_CST) { /* This is the case of (unsigned char)x >?< -1 or < 0. */ if (val == integer_zero_node) |