tree-vrp.c (compare_name_with_value): Always set used_strict_overflow if we get a result from the variable itself.

./:	* tree-vrp.c (compare_name_with_value): Always set
	used_strict_overflow if we get a result from the variable itself.
testsuite/:
	* gcc.dg/Wstrict-overflow-17.c: New test.

From-SVN: r125269
This commit is contained in:
Ian Lance Taylor 2007-06-01 22:47:02 +00:00 committed by Ian Lance Taylor
parent 069a73f9a4
commit e07e405d7b
4 changed files with 31 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2007-06-01 Ian Lance Taylor <iant@google.com>
* tree-vrp.c (compare_name_with_value): Always set
used_strict_overflow if we get a result from the variable itself.
2007-06-01 Ian Lance Taylor <iant@google.com>
PR rtl-optimization/31455

View file

@ -1,3 +1,7 @@
2007-06-01 Ian Lance Taylor <iant@google.com>
* gcc.dg/Wstrict-overflow-17.c: New test.
2007-06-01 Kazu Hirata <kazu@codesourcery.com>
* gcc.dg/builtin-return-1.c (g): New.

View file

@ -0,0 +1,20 @@
/* { dg-do compile } */
/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
/* This erroneously gave an overflow warning. */
extern void bar (char);
void
foo (char *s)
{
int len, i;
for (len = 1; len < 5000; ++len)
{
for (i = 0; i < len; ++i)
{
if (s[i] != '\0')
bar (s[i]);
}
}
}

View file

@ -4676,8 +4676,8 @@ compare_name_with_value (enum tree_code comp, tree var, tree val,
equiv_vr = get_vr_for_comparison (SSA_NAME_VERSION (var));
sop = false;
retval = compare_range_with_value (comp, &equiv_vr, val, &sop);
if (sop)
used_strict_overflow = 1;
if (retval)
used_strict_overflow = sop ? 1 : 0;
/* If the equiv set is empty we have done all work we need to do. */
if (e == NULL)