From: Marek Polacek Date: Thu, 19 May 2016 15:45:35 +0000 (+0000) Subject: re PR tree-optimization/71031 (ICE in extract_range_from_binary_expr_1, at tree-vrp... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4177437ead62c0c74d560f3611b3583078f59688;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 883892bc1f9..4900c7e2d46 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-19 Marek Polacek + + 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 * tree-vect-stmts.c (vectorizable_simd_clone_call): Utilize diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b071e9f5a05..f9ea24016ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-19 Marek Polacek + + PR tree-optimization/71031 + * gcc.dg/tree-ssa/vrp100.c: New test. + 2016-05-19 Ilya Enkovich PR rtl-optimization/71148 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp100.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp100.c new file mode 100644 index 00000000000..c0fe4b50963 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp100.c @@ -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; + } + } + } +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 69e6248a4fc..92d889cd1e2 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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 {