From: Jakub Jelinek Date: Mon, 25 Jun 2018 17:47:56 +0000 (+0200) Subject: backport: re PR rtl-optimization/85300 (ICE in exact_int_to_float_conversion_p, at... X-Git-Tag: releases/gcc-6.5.0~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e313c255072ee6634d08f2983897d13f5f9b775d;p=thirdparty%2Fgcc.git backport: re PR rtl-optimization/85300 (ICE in exact_int_to_float_conversion_p, at simplify-rtx.c:895) Backported from mainline 2018-04-10 Jakub Jelinek 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: r262096 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5e68d916467..c204f20647ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2018-06-25 Jakub Jelinek Backported from mainline + 2018-04-10 Jakub Jelinek + + 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 PR tree-optimization/85257 diff --git a/gcc/combine.c b/gcc/combine.c index 8ffb21dc10a8..b6024bf075d8 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5435,11 +5435,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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07ca2480ba5a..92d3b5aaeb35 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2018-04-10 Jakub Jelinek + 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 index 000000000000..87a30b8d419a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr85300.c @@ -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; + } +}