Commit 344be1fd by Richard Biener Committed by Richard Biener

tree-vrp.c (vrp_int_const_binop): Do not set *overflow_p to true when overflow…

tree-vrp.c (vrp_int_const_binop): Do not set *overflow_p to true when overflow is undefined and we saturated the...

2017-08-17  Richard Biener  <rguenther@suse.de>

	* tree-vrp.c (vrp_int_const_binop): Do not set *overflow_p
	to true when overflow is undefined and we saturated the
	result.

	* gcc.dg/tree-ssa/vrp117.c: New testcase.

From-SVN: r251141
parent b263d657
2017-08-17 Richard Biener <rguenther@suse.de>
* tree-vrp.c (vrp_int_const_binop): Do not set *overflow_p
to true when overflow is undefined and we saturated the
result.
2017-08-17 Alan Modra <amodra@gmail.com> 2017-08-17 Alan Modra <amodra@gmail.com>
PR target/80938 PR target/80938
......
2017-08-17 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/vrp117.c: New testcase.
2017-08-16 Uros Bizjak <ubizjak@gmail.com> 2017-08-16 Uros Bizjak <ubizjak@gmail.com>
* c-c++-common/patchable_function_entry-decl.c (dg-final): Adapt * c-c++-common/patchable_function_entry-decl.c (dg-final): Adapt
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-evrp" } */
void link_error (void);
void foo (int i)
{
if (i > __INT_MAX__ - 10)
{
int j = i * 10;
if (j < i)
link_error ();
}
}
/* { dg-final { scan-tree-dump-not "link_error" "evrp" } } */
...@@ -1614,6 +1614,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2, ...@@ -1614,6 +1614,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
signop sign = TYPE_SIGN (TREE_TYPE (val1)); signop sign = TYPE_SIGN (TREE_TYPE (val1));
wide_int res; wide_int res;
*overflow_p = false;
switch (code) switch (code)
{ {
case RSHIFT_EXPR: case RSHIFT_EXPR:
...@@ -1685,8 +1687,6 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2, ...@@ -1685,8 +1687,6 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
gcc_unreachable (); gcc_unreachable ();
} }
*overflow_p = overflow;
if (overflow if (overflow
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1))) && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1)))
{ {
...@@ -1730,6 +1730,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2, ...@@ -1730,6 +1730,8 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2,
TYPE_SIGN (TREE_TYPE (val1))); TYPE_SIGN (TREE_TYPE (val1)));
} }
*overflow_p = overflow;
return res; return res;
} }
......
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