aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-03-08 11:43:10 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-03-08 11:43:10 +0100
commit32bd240907e86af72aac473508bd36349dcfd183 (patch)
tree389f894dd1309baa2332849fcc5bad7843403dd4 /gcc/fold-const.c
parent93dd46fb792863cd5d7893867d93e7f0ea69322c (diff)
downloadgcc-32bd240907e86af72aac473508bd36349dcfd183.zip
gcc-32bd240907e86af72aac473508bd36349dcfd183.tar.gz
gcc-32bd240907e86af72aac473508bd36349dcfd183.tar.bz2
re PR tree-optimization/48022 (-Wstrict-overflow warning on code that doesn't have overflows)
PR tree-optimization/48022 * fold-const.c (fold_comparison): Don't call fold_overflow_warning for EQ/NE_EXPR. * gcc.dg/pr48022-1.c: New test. * gcc.dg/pr48022-2.c: New test. From-SVN: r170772
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 07b59d8..957049c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1,6 +1,6 @@
/* Fold a constant sub-tree into a single node for C-compiler
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -8572,10 +8572,11 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
&& (TREE_CODE (lhs) != INTEGER_CST
|| !TREE_OVERFLOW (lhs)))
{
- fold_overflow_warning ("assuming signed overflow does not occur "
- "when changing X +- C1 cmp C2 to "
- "X cmp C1 +- C2",
- WARN_STRICT_OVERFLOW_COMPARISON);
+ if (code != EQ_EXPR && code != NE_EXPR)
+ fold_overflow_warning ("assuming signed overflow does not occur "
+ "when changing X +- C1 cmp C2 to "
+ "X cmp C1 +- C2",
+ WARN_STRICT_OVERFLOW_COMPARISON);
return fold_build2_loc (loc, code, type, variable, lhs);
}
}