]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/83418 (ICE in extract_range_for_var_from_comparison_expr...
authorRichard Biener <rguenther@suse.de>
Thu, 14 Dec 2017 11:12:52 +0000 (11:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 14 Dec 2017 11:12:52 +0000 (11:12 +0000)
2017-12-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83418
* vr-values.c (vr_values::extract_range_for_var_from_comparison_expr):
Instead of asserting we don't get unfolded comparisons deal with
them.

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

From-SVN: r255628

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr83418.c [new file with mode: 0644]
gcc/vr-values.c

index 504b331ec8afff7046b5184472e99efad5a3d9d7..d18230841f4cf0e7d582ec0da71f6fd65d06100f 100644 (file)
@@ -1,3 +1,10 @@
+2017-12-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83418
+       * vr-values.c (vr_values::extract_range_for_var_from_comparison_expr):
+       Instead of asserting we don't get unfolded comparisons deal with
+       them.
+
 2017-12-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/83396
index ff3747961b54468a101cde30be7a1f0793e72ec0..811568e7d2a4babd4c65fce1612873870a1a5e0f 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83418
+       * gcc.dg/torture/pr83418.c: New testcase.
+
 2017-12-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/83396
diff --git a/gcc/testsuite/gcc.dg/torture/pr83418.c b/gcc/testsuite/gcc.dg/torture/pr83418.c
new file mode 100644 (file)
index 0000000..b545a39
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+void
+yj (int j4)
+{
+  int t3;
+
+  for (t3 = 0; t3 < 6; ++t3)
+    {
+      short int v4 = t3;
+
+      if (v4 == j4 || v4 > t3)
+       for (;;)
+         {
+         }
+    }
+}
index 9352e120d9d1772222d26378233e66bc32db9e22..794b4635f9ec50306ba82dbfa91393f6a971ed44 100644 (file)
@@ -445,11 +445,12 @@ vr_values::extract_range_for_var_from_comparison_expr (tree var,
   tree  min, max, type;
   value_range *limit_vr;
   type = TREE_TYPE (var);
-  gcc_assert (limit != var);
 
   /* For pointer arithmetic, we only keep track of pointer equality
-     and inequality.  */
-  if (POINTER_TYPE_P (type) && cond_code != NE_EXPR && cond_code != EQ_EXPR)
+     and inequality.  If we arrive here with unfolded conditions like
+     _1 > _1 do not derive anything.  */
+  if ((POINTER_TYPE_P (type) && cond_code != NE_EXPR && cond_code != EQ_EXPR)
+      || limit == var)
     {
       set_value_range_to_varying (vr_p);
       return;