Commit ee68591e by Richard Biener Committed by Richard Biener

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
parent 9d55066c
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.
2014-10-09 Uros Bizjak <ubizjak@gmail.com> 2014-10-09 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/57003 PR rtl-optimization/57003
2014-10-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/63445
* gcc.dg/Wstrict-overflow-26.c: New testcase.
2014-10-08 Pat Haugen <pthaugen@us.ibm.com> 2014-10-08 Pat Haugen <pthaugen@us.ibm.com>
* gcc.dg/vmx/3c-01a.c: Add default options from vmx.exp. * gcc.dg/vmx/3c-01a.c: Add default options from vmx.exp.
......
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-overflow" } */
int
f (int i, int j)
{
unsigned int c = 0;
if (i < j)
{
unsigned int n = j - i;
unsigned int i;
for (i = 0; i < n; i++) /* { dg-bogus "signed overflow" } */
c++;
}
return c;
}
...@@ -9189,8 +9189,9 @@ simplify_cond_using_ranges (gimple stmt) ...@@ -9189,8 +9189,9 @@ simplify_cond_using_ranges (gimple stmt)
/* If the range overflowed and the user has asked for warnings /* If the range overflowed and the user has asked for warnings
when strict overflow semantics were used to optimize code, when strict overflow semantics were used to optimize code,
issue an appropriate warning. */ issue an appropriate warning. */
if ((is_negative_overflow_infinity (vr->min) if (cond_code != EQ_EXPR && cond_code != NE_EXPR
|| is_positive_overflow_infinity (vr->max)) && (is_negative_overflow_infinity (vr->min)
|| is_positive_overflow_infinity (vr->max))
&& issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_CONDITIONAL)) && issue_strict_overflow_warning (WARN_STRICT_OVERFLOW_CONDITIONAL))
{ {
location_t location; location_t location;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment