re PR tree-optimization/65875 (ICE: Segmentation fault)

PR tree-optimization/65875
	* tree-vrp.c (update_value_range): If in is_new case setting
	old_vr to VR_VARYING, also set new_vr to it.  Remove
	old_vr->type == VR_VARYING test.
	(vrp_visit_phi_node): Return SSA_PROP_VARYING instead of
	SSA_PROP_INTERESTING if update_value_range returned true,
	but new range is VR_VARYING.

	* gcc.c-torture/compile/pr65875.c: New test.

From-SVN: r222458
This commit is contained in:
Jakub Jelinek 2015-04-27 13:26:12 +02:00 committed by Jakub Jelinek
parent 97d87f7502
commit 9c3cb36079
4 changed files with 52 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2015-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65875
* tree-vrp.c (update_value_range): If in is_new case setting
old_vr to VR_VARYING, also set new_vr to it. Remove
old_vr->type == VR_VARYING test.
(vrp_visit_phi_node): Return SSA_PROP_VARYING instead of
SSA_PROP_INTERESTING if update_value_range returned true,
but new range is VR_VARYING.
2015-04-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
* combine.c (sign_extend_short_imm): New.

View File

@ -1,3 +1,8 @@
2015-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65875
* gcc.c-torture/compile/pr65875.c: New test.
2015-04-25 Marek Polacek <polacek@redhat.com>
PR c/52085

View File

@ -0,0 +1,24 @@
/* PR tree-optimization/65875 */
int a, b, c, d, e, f, g;
void
foo (void)
{
long h = 0, i;
if (g < 0)
i = -g;
for (; b;)
for (; c;)
if (e)
h = 1;
for (; f;)
if (a)
break;
if (h > i)
while (h > i)
{
d = 0;
h--;
}
}

View File

@ -886,13 +886,18 @@ update_value_range (const_tree var, value_range_t *new_vr)
if (is_new)
{
/* Do not allow transitions up the lattice. The following
is slightly more awkward than just new_vr->type < old_vr->type
is slightly more awkward than just new_vr->type < old_vr->type
because VR_RANGE and VR_ANTI_RANGE need to be considered
the same. We may not have is_new when transitioning to
UNDEFINED or from VARYING. */
if (new_vr->type == VR_UNDEFINED
|| old_vr->type == VR_VARYING)
set_value_range_to_varying (old_vr);
UNDEFINED. If old_vr->type is VARYING, we shouldn't be
called. */
if (new_vr->type == VR_UNDEFINED)
{
BITMAP_FREE (new_vr->equiv);
set_value_range_to_varying (old_vr);
set_value_range_to_varying (new_vr);
return true;
}
else
set_value_range (old_vr, new_vr->type, new_vr->min, new_vr->max,
new_vr->equiv);
@ -8941,6 +8946,9 @@ update_range:
fprintf (dump_file, "\n");
}
if (vr_result.type == VR_VARYING)
return SSA_PROP_VARYING;
return SSA_PROP_INTERESTING;
}