From eef7b18cb7a0b63ff4d260aafcf9f9a3481c5add Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 28 Nov 2014 19:33:35 +0000 Subject: [PATCH] re PR target/64061 (ICE: in gen_rtx_SUBREG, at emit-rtl.c:894 with -O2 -g -fno-dce -fno-tree-dce) 2014-11-28 Vladimir Makarov PR target/64061 * lra.c (lra_substitute_pseudo): Ignore constant with int mode for subreg. 2014-11-28 Vladimir Makarov PR target/64061 * gcc.target/i386/pr64061.c: New. From-SVN: r218171 --- gcc/ChangeLog | 6 ++++++ gcc/lra.c | 3 ++- gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/gcc.target/i386/pr64061.c | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr64061.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8f8dbe8bbe..92e0af5dff7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-28 Vladimir Makarov + + PR target/64061 + * lra.c (lra_substitute_pseudo): Ignore constant with int mode for + subreg. + 2014-11-28 Segher Boessenkool PR target/64093 diff --git a/gcc/lra.c b/gcc/lra.c index ec122c7762f..65350631501 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -1806,7 +1806,8 @@ lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg) machine_mode mode = GET_MODE (*loc); machine_mode inner_mode = GET_MODE (new_reg); - if (mode != inner_mode) + if (mode != inner_mode + && ! (CONST_INT_P (new_reg) && SCALAR_INT_MODE_P (mode))) { if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (inner_mode) || ! SCALAR_INT_MODE_P (inner_mode)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 39aa1789e43..31bcf5cd683 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-28 Vladimir Makarov + + PR target/64061 + * gcc.target/i386/pr64061.c: New. + 2014-11-28 Marek Polacek * c-c++-common/ubsan/shift-8.c: New test. @@ -5,7 +10,7 @@ 2014-11-28 Vladimir Makarov PR rtl-optimization/64087 - * gcc.dg/pr64087.c: New. + * gcc.dg/pr64087.c: New. 2014-11-28 H.J. Lu diff --git a/gcc/testsuite/gcc.target/i386/pr64061.c b/gcc/testsuite/gcc.target/i386/pr64061.c new file mode 100644 index 00000000000..5794d06bbda --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64061.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -fno-dce -fno-tree-dce" } */ + +extern void *buf; + +extern void bar (void); + +int +foo (int i) +{ + int j = 0; + if (__builtin_setjmp (buf) == 0) + { + while (1) + { + j = 1; + bar (); + } + } + return j ? i : 0; +} -- 2.30.2