aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-06-23 17:10:10 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-06-23 17:10:10 +0000
commita68ae2e1b15892b8e822f5a99f2b9d1e59b56e4c (patch)
tree7148f747e2eb677ef00013e410bce7fcd6952131 /gcc/c-family
parent171561ca339eaea296a43c8f5b328bf3a66e3af2 (diff)
downloadgcc-a68ae2e1b15892b8e822f5a99f2b9d1e59b56e4c.zip
gcc-a68ae2e1b15892b8e822f5a99f2b9d1e59b56e4c.tar.gz
gcc-a68ae2e1b15892b8e822f5a99f2b9d1e59b56e4c.tar.bz2
c-common.c (warn_logical_operator): Use tree_int_cst_equal when comparing INTEGER_CSTs.
* c-common.c (warn_logical_operator): Use tree_int_cst_equal when comparing INTEGER_CSTs. * c-c++-common/Wlogical-op-3.c: New test. From-SVN: r224853
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index a721ab5..e2bd7e9 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-23 Marek Polacek <polacek@redhat.com>
+
+ * c-common.c (warn_logical_operator): Use tree_int_cst_equal
+ when comparing INTEGER_CSTs.
+
2015-06-22 Pierre-Marie de Rodat <derodat@adacore.com>
* c-ada-spec.h (cpp_operation): Add HAS_DEPENDENT_TEMPLATE_ARGS.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index c39a36de..9fcd9d6 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1838,7 +1838,8 @@ warn_logical_operator (location_t location, enum tree_code code, tree type,
}
/* Or warn if the operands have exactly the same range, e.g.
A > 0 && A > 0. */
- else if (low0 == low1 && high0 == high1)
+ else if (tree_int_cst_equal (low0, low1)
+ && tree_int_cst_equal (high0, high1))
{
if (or_op)
warning_at (location, OPT_Wlogical_op,