Commit 635bfae0 by Richard Biener Committed by Richard Biener

re PR tree-optimization/59245 (ICE on valid code at -O3 on x86_64-linux-gnu in…

re PR tree-optimization/59245 (ICE on valid code at -O3 on x86_64-linux-gnu in set_value_range, at tree-vrp.c:443)

2013-11-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/59245
	* tree-vrp.c (set_value_range): Assert that we don't have
	overflowed constants (but our infinities).
	(set_value_range_to_value): Drop all overflow flags.
	(vrp_visit_phi_node): Likewise.
	(vrp_visit_assignment_or_call): Use set_value_range_to_value
	to set a constant range.

	* gcc.dg/torture/pr59245.c: New testcase.

From-SVN: r205395
parent a866fa46
2013-11-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/59245
* tree-vrp.c (set_value_range): Assert that we don't have
overflowed constants (but our infinities).
(set_value_range_to_value): Drop all overflow flags.
(vrp_visit_phi_node): Likewise.
(vrp_visit_assignment_or_call): Use set_value_range_to_value
to set a constant range.
2013-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/59290
2013-11-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/59245
* gcc.dg/torture/pr59245.c: New testcase.
2013-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/59290
......
/* { dg-do compile } */
int a, b, c, e, g;
char d[5], f;
int
fn1 ()
{
if (b)
{
g = 0;
return 0;
}
for (f = 0; f != 1; f--)
;
return 0;
}
void
fn2 ()
{
d[4] = -1;
for (a = 4; a; a--)
{
fn1 ();
e = c < -2147483647 - 1 - d[a] ? c : 0;
}
}
......@@ -441,6 +441,9 @@ set_value_range (value_range_t *vr, enum value_range_type t, tree min,
gcc_assert (min && max);
gcc_assert ((!TREE_OVERFLOW_P (min) || is_overflow_infinity (min))
&& (!TREE_OVERFLOW_P (max) || is_overflow_infinity (max)));
if (INTEGRAL_TYPE_P (TREE_TYPE (min)) && t == VR_ANTI_RANGE)
gcc_assert (!vrp_val_is_min (min) || !vrp_val_is_max (max));
......@@ -616,7 +619,8 @@ static inline void
set_value_range_to_value (value_range_t *vr, tree val, bitmap equiv)
{
gcc_assert (is_gimple_min_invariant (val));
val = avoid_overflow_infinity (val);
if (TREE_OVERFLOW_P (val))
val = drop_tree_overflow (val);
set_value_range (vr, VR_RANGE, val, val, equiv);
}
......@@ -6738,8 +6742,8 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p)
/* Try folding the statement to a constant first. */
tree tem = gimple_fold_stmt_to_constant (stmt, vrp_valueize);
if (tem && !is_overflow_infinity (tem))
set_value_range (&new_vr, VR_RANGE, tem, tem, NULL);
if (tem)
set_value_range_to_value (&new_vr, tem, NULL);
/* Then dispatch to value-range extracting functions. */
else if (code == GIMPLE_CALL)
extract_range_basic (&new_vr, stmt);
......@@ -8336,7 +8340,7 @@ vrp_visit_phi_node (gimple phi)
}
else
{
if (is_overflow_infinity (arg))
if (TREE_OVERFLOW_P (arg))
arg = drop_tree_overflow (arg);
vr_arg.type = VR_RANGE;
......
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