From 8396a8d6fa187f93296c401f76b4150f9b3037aa Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sun, 31 Oct 1993 03:13:52 +0000 Subject: [PATCH] (shorten_compare): Do nothing if both args constant. From-SVN: r5954 --- gcc/c-common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/c-common.c b/gcc/c-common.c index a6e78260841..37d0458e769 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. */ -- 2.30.2