aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-10-31 03:13:52 +0000
committerRichard Stallman <rms@gnu.org>1993-10-31 03:13:52 +0000
commit8396a8d6fa187f93296c401f76b4150f9b3037aa (patch)
treea97c431ec19396bc035762c5e9ca2386441e3135 /gcc/c-common.c
parenta81fee56a95764ef7040351599e20506c879fa6a (diff)
downloadgcc-8396a8d6fa187f93296c401f76b4150f9b3037aa.zip
gcc-8396a8d6fa187f93296c401f76b4150f9b3037aa.tar.gz
gcc-8396a8d6fa187f93296c401f76b4150f9b3037aa.tar.bz2
(shorten_compare): Do nothing if both args constant.
From-SVN: r5954
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a6e7826..37d0458 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1259,6 +1259,13 @@ 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. */