re PR tree-optimization/71031 (ICE in extract_range_from_binary_expr_1, at tree-vrp.c:2535 w/ -Os)

PR tree-optimization/71031
	* tree-vrp.c (extract_range_from_binary_expr_1): Turn assert into a
	condition and adjust the code a bit.

	* gcc.dg/tree-ssa/vrp100.c: New test.

From-SVN: r236477
This commit is contained in:
Marek Polacek 2016-05-19 15:45:35 +00:00 committed by Marek Polacek
parent 00426f9a9e
commit 4177437ead
4 changed files with 51 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2016-05-19 Marek Polacek <polacek@redhat.com>
PR tree-optimization/71031
* tree-vrp.c (extract_range_from_binary_expr_1): Turn assert into a
condition and adjust the code a bit.
2016-05-19 Martin Liska <mliska@suse.cz>
* tree-vect-stmts.c (vectorizable_simd_clone_call): Utilize

View File

@ -1,3 +1,8 @@
2016-05-19 Marek Polacek <polacek@redhat.com>
PR tree-optimization/71031
* gcc.dg/tree-ssa/vrp100.c: New test.
2016-05-19 Ilya Enkovich <ilya.enkovich@intel.com>
PR rtl-optimization/71148

View File

@ -0,0 +1,32 @@
/* PR tree-optimization/71031 */
/* { dg-do compile } */
/* { dg-options "-Os" } */
int zj;
int **yr;
void
nn (void)
{
unsigned int od = 4;
for (;;)
{
int lk;
for (lk = 0; lk < 2; ++lk)
{
static int cm;
zj = 0;
if (od == 0)
return;
++od;
for (cm = 0; cm < 2; ++cm)
{
--od;
**yr = 0;
}
}
}
}

View File

@ -2519,20 +2519,13 @@ extract_range_from_binary_expr_1 (value_range *vr,
min = wide_int_to_tree (expr_type, tmin);
max = wide_int_to_tree (expr_type, tmax);
}
else if (min_ovf == -1 && max_ovf == 1)
{
/* Underflow and overflow, drop to VR_VARYING. */
set_value_range_to_varying (vr);
return;
}
else
else if ((min_ovf == -1 && max_ovf == 0)
|| (max_ovf == 1 && min_ovf == 0))
{
/* Min underflow or max overflow. The range kind
changes to VR_ANTI_RANGE. */
bool covers = false;
wide_int tem = tmin;
gcc_assert ((min_ovf == -1 && max_ovf == 0)
|| (max_ovf == 1 && min_ovf == 0));
type = VR_ANTI_RANGE;
tmin = tmax + 1;
if (wi::cmp (tmin, tmax, sgn) < 0)
@ -2551,6 +2544,12 @@ extract_range_from_binary_expr_1 (value_range *vr,
min = wide_int_to_tree (expr_type, tmin);
max = wide_int_to_tree (expr_type, tmax);
}
else
{
/* Other underflow and/or overflow, drop to VR_VARYING. */
set_value_range_to_varying (vr);
return;
}
}
else
{