]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/85300 (ICE in exact_int_to_float_conversion_p, at...
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 21:10:17 +0000 (23:10 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:10:17 +0000 (23:10 +0200)
Backported from mainline
2018-04-10  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/85300
* combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
simplify_unary_operation fails.

* gcc.dg/pr85300.c: New test.

From-SVN: r261953

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr85300.c [new file with mode: 0644]

index 6ccef0ddecbd97208c65000cc7609e82d7b78fa6..2850fa03bfe8a16bc400add4705f415b770f5ddc 100644 (file)
@@ -1,6 +1,13 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/85300
+       * combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
+       into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
+       simplify_unary_operation fails.
+
        2018-04-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/85257
index d1133c3ce5246ee0090cb0091239dc20c3df7855..81c40d84fa98cdbc754578eda1adff17e5476496 100644 (file)
@@ -5482,11 +5482,15 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
                    x = gen_rtx_CLOBBER (mode, const0_rtx);
                }
              else if (CONST_SCALAR_INT_P (new_rtx)
-                      && GET_CODE (x) == ZERO_EXTEND)
+                      && (GET_CODE (x) == ZERO_EXTEND
+                          || GET_CODE (x) == FLOAT
+                          || GET_CODE (x) == UNSIGNED_FLOAT))
                {
-                 x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
-                                               new_rtx, GET_MODE (XEXP (x, 0)));
-                 gcc_assert (x);
+                 x = simplify_unary_operation (GET_CODE (x), GET_MODE (x),
+                                               new_rtx,
+                                               GET_MODE (XEXP (x, 0)));
+                 if (!x)
+                   return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
                }
              else
                SUBST (XEXP (x, i), new_rtx);
index 2a1ddd18a27234b6f7dd89e8fcbff1bc9696c70d..27f70405941e57181af26013a2d851ad4cbdecc2 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-04-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/85300
+       * gcc.dg/pr85300.c: New test.
+
        PR fortran/85313
        * gfortran.dg/gomp/pr85313.f90: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr85300.c b/gcc/testsuite/gcc.dg/pr85300.c
new file mode 100644 (file)
index 0000000..87a30b8
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/85300 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g -funroll-all-loops -fno-tree-ter -fno-web" } */
+
+void
+foo (double x, unsigned char y)
+{
+  while ((int) x < 1)
+    {
+      float a;
+
+      a = y | 0x100;
+      y = 0;
+      x = a;
+    }
+}