aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-10-09 08:20:53 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-10-09 08:20:53 +0000
commitee68591e69621b4fdbbd925044b66b6147800cf9 (patch)
treebb758a1c6c30688ffeabdbe9b62736d35f09b005 /gcc/tree-vrp.c
parent9d55066c88b4c276a969ea2b86614c7bd034f212 (diff)
downloadgcc-ee68591e69621b4fdbbd925044b66b6147800cf9.zip
gcc-ee68591e69621b4fdbbd925044b66b6147800cf9.tar.gz
gcc-ee68591e69621b4fdbbd925044b66b6147800cf9.tar.bz2
re PR tree-optimization/63445 (request: make -Wstrict-overflow avoid a class of false positives)
2014-10-09 Richard Biener <rguenther@suse.de> PR tree-optimization/63445 * tree-vrp.c (simplify_cond_using_ranges): Only warn about overflow for non-equality compares. * gcc.dg/Wstrict-overflow-26.c: New testcase. From-SVN: r216028
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 011db78..7ca0528 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9189,8 +9189,9 @@ simplify_cond_using_ranges (gimple stmt)
/* If the range overflowed and the user has asked for warnings
when strict overflow semantics were used to optimize code,
issue an appropriate warning. */
- if ((is_negative_overflow_infinity (vr->min)
- || is_positive_overflow_infinity (vr->max))
+ if (cond_code != EQ_EXPR && cond_code != NE_EXPR
+ && (is_negative_overflow_infinity (vr->min)
+ || is_positive_overflow_infinity (vr->max))
&& issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_CONDITIONAL))
{
location_t location;