mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 12:00:03 -05:00
tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a PLUS_EXPR or MINUS_EXPR node before setting...
./: * tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a PLUS_EXPR or MINUS_EXPR node before setting *strict_overflow_p. (extract_range_from_assert): Set TREE_NO_WARNING when creating an expression. (test_for_singularity): Likewise. testsuite/: * gcc.dg/Wstrict-overflow-19.c: New test. From-SVN: r125335
This commit is contained in:
committed by
Ian Lance Taylor
parent
57eed70974
commit
e596a3130b
@@ -1,3 +1,11 @@
|
||||
2007-06-05 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a
|
||||
PLUS_EXPR or MINUS_EXPR node before setting *strict_overflow_p.
|
||||
(extract_range_from_assert): Set TREE_NO_WARNING when creating an
|
||||
expression.
|
||||
(test_for_singularity): Likewise.
|
||||
|
||||
2007-06-04 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* tree-vrp.c (adjust_range_with_scev): When loop is not expected
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2007-06-05 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* gcc.dg/Wstrict-overflow-19.c: New test.
|
||||
|
||||
2007-06-04 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* gcc.dg/Wstrict-overflow-18.c: New test.
|
||||
|
||||
15
gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
Normal file
15
gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
|
||||
|
||||
/* Don't warn about an overflow when threading jumps. We used to get
|
||||
a warning from comparing bounds generated by VRP. */
|
||||
|
||||
int
|
||||
bar(int a, int b, int n)
|
||||
{
|
||||
if (b > a)
|
||||
n = a - b;
|
||||
if (a >= b)
|
||||
n = 1;
|
||||
return n;
|
||||
}
|
||||
@@ -771,7 +771,9 @@ compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p)
|
||||
if (!TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1)))
|
||||
return -2;
|
||||
|
||||
if (strict_overflow_p != NULL)
|
||||
if (strict_overflow_p != NULL
|
||||
&& (code1 == SSA_NAME || !TREE_NO_WARNING (val1))
|
||||
&& (code2 == SSA_NAME || !TREE_NO_WARNING (val2)))
|
||||
*strict_overflow_p = true;
|
||||
|
||||
if (code1 == SSA_NAME)
|
||||
@@ -1177,6 +1179,8 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
|
||||
{
|
||||
tree one = build_int_cst (type, 1);
|
||||
max = fold_build2 (MINUS_EXPR, type, max, one);
|
||||
if (EXPR_P (max))
|
||||
TREE_NO_WARNING (max) = 1;
|
||||
}
|
||||
|
||||
set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
|
||||
@@ -1210,6 +1214,8 @@ extract_range_from_assert (value_range_t *vr_p, tree expr)
|
||||
{
|
||||
tree one = build_int_cst (type, 1);
|
||||
min = fold_build2 (PLUS_EXPR, type, min, one);
|
||||
if (EXPR_P (min))
|
||||
TREE_NO_WARNING (min) = 1;
|
||||
}
|
||||
|
||||
set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
|
||||
@@ -5042,6 +5048,8 @@ test_for_singularity (enum tree_code cond_code, tree op0,
|
||||
{
|
||||
tree one = build_int_cst (TREE_TYPE (op0), 1);
|
||||
max = fold_build2 (MINUS_EXPR, TREE_TYPE (op0), max, one);
|
||||
if (EXPR_P (max))
|
||||
TREE_NO_WARNING (max) = 1;
|
||||
}
|
||||
}
|
||||
else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
|
||||
@@ -5055,6 +5063,8 @@ test_for_singularity (enum tree_code cond_code, tree op0,
|
||||
{
|
||||
tree one = build_int_cst (TREE_TYPE (op0), 1);
|
||||
min = fold_build2 (PLUS_EXPR, TREE_TYPE (op0), min, one);
|
||||
if (EXPR_P (min))
|
||||
TREE_NO_WARNING (min) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user