From: Richard Biener Date: Wed, 14 Dec 2016 08:33:12 +0000 (+0000) Subject: re PR tree-optimization/78788 (ICE (segfault) on s390x-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=253c0172bb2c525b784355d75ac484b03fa7273b;p=gcc.git re PR tree-optimization/78788 (ICE (segfault) on s390x-linux-gnu) 2016-12-14 Richard Biener PR tree-optimization/78788 * tree-vrp.c (set_value_range): Allow [-INF(OVF), +INF(OVF)]. (set_and_canonicalize_value_range): Do not drop the above to VARYING. * gcc.dg/torture/pr78788.c: New testcase. From-SVN: r243631 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dff1b829ce5..17a33618b5e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-12-14 Richard Biener + + PR tree-optimization/78788 + * tree-vrp.c (set_value_range): Allow [-INF(OVF), +INF(OVF)]. + (set_and_canonicalize_value_range): Do not drop the above to + VARYING. + 2016-12-13 Bill Schmidt * config/rs6000/rs600.c (rs6000_builtin_vectorization_cost): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4378e36bbe7..2be6da24268 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-14 Richard Biener + + PR tree-optimization/78788 + * gcc.dg/torture/pr78788.c: New testcase. + 2016-12-13 Nathan Sidwell PR c++/69481 diff --git a/gcc/testsuite/gcc.dg/torture/pr78788.c b/gcc/testsuite/gcc.dg/torture/pr78788.c new file mode 100644 index 00000000000..9861260b4ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78788.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +int a; +long b; +long c; +void d() +{ + int e = 0; + for (; b; b++) + if (c) + { + e++; + e++; + } + while (e) + a = e -= 2; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 600634d1804..3535d7a4d83 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -365,10 +365,6 @@ set_value_range (value_range *vr, enum value_range_type t, tree min, cmp = compare_values (min, max); gcc_assert (cmp == 0 || cmp == -1 || cmp == -2); - - if (needs_overflow_infinity (TREE_TYPE (min))) - gcc_assert (!is_overflow_infinity (min) - || !is_overflow_infinity (max)); } if (flag_checking @@ -506,14 +502,9 @@ set_and_canonicalize_value_range (value_range *vr, enum value_range_type t, } } - /* Drop [-INF(OVF), +INF(OVF)] to varying. */ - if (needs_overflow_infinity (TREE_TYPE (min)) - && is_overflow_infinity (min) - && is_overflow_infinity (max)) - { - set_value_range_to_varying (vr); - return; - } + /* Do not drop [-INF(OVF), +INF(OVF)] to varying. (OVF) has to be sticky + to make sure VRP iteration terminates, otherwise we can get into + oscillations. */ set_value_range (vr, t, min, max, equiv); }