re PR middle-end/89655 (GCC crashes building linux kernel for arm 32-bit (culprit...
authorJakub Jelinek <jakub@redhat.com>
Mon, 11 Mar 2019 21:58:43 +0000 (22:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 11 Mar 2019 21:58:43 +0000 (22:58 +0100)
PR middle-end/89655
PR bootstrap/89656
* vr-values.c (vr_values::update_value_range): If
old_vr->varying_p (), don't update it, make new_vr also VARYING
and return false.

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

From-SVN: r269597

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

index 2d087534917b90e58b84d4d78ac231a5dbc3d88f..64bf6017d16fb17faeb01f331b3db42b020351be 100644 (file)
@@ -1,3 +1,11 @@
+2019-03-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/89655
+       PR bootstrap/89656
+       * vr-values.c (vr_values::update_value_range): If
+       old_vr->varying_p (), don't update it, make new_vr also VARYING
+       and return false.
+
 2019-03-11  Martin Liska  <mliska@suse.cz>
 
        * config/aarch64/aarch64.c (aarch64_override_options_internal):
index 6ae27496180c7d2bd030cd80cd46eb72c7bc3ade..fdc7c40e4502d889f3551ae821e4c176d1078a55 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/89655
+       PR bootstrap/89656
+       * gcc.c-torture/compile/pr89655.c: New test.
+
 2019-03-11  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/arm/f16_f64_conv_no_dp.c: Add arm_fp16_ok effective
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89655.c b/gcc/testsuite/gcc.c-torture/compile/pr89655.c
new file mode 100644 (file)
index 0000000..f304c67
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/89655 */
+
+int a, b, d;
+char *c;
+
+void
+foo (void)
+{
+  int f = a;
+  for (;;)
+    {
+      for (f = 0; f < (a > 3 ? : a); f++)
+       b = c[f] ? c[(f + 2 > a - 1 ? a - 1 : 2) * d] : 0;
+    }
+}
index a734ef93f3d274acd9011698beb28eaf5abe613e..0e10aca92bbde90e03156dea0a9a40273f57f2e6 100644 (file)
@@ -189,8 +189,13 @@ vr_values::update_value_range (const_tree var, value_range *new_vr)
         because VR_RANGE and VR_ANTI_RANGE need to be considered
         the same.  We may not have is_new when transitioning to
         UNDEFINED.  If old_vr->type is VARYING, we shouldn't be
-        called.  */
-      if (new_vr->undefined_p ())
+        called, if we are anyway, keep it VARYING.  */
+      if (old_vr->varying_p ())
+       {
+         new_vr->set_varying ();
+         is_new = false;
+       }
+      else if (new_vr->undefined_p ())
        {
          old_vr->set_varying ();
          new_vr->set_varying ();