From 1ae304212d35a01ca79ebf2b33de836afab827e7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 19 Jul 2011 21:32:12 +0200 Subject: [PATCH] backport: re PR rtl-optimization/49619 (ICE in simplify_subreg, at simplify-rtx.c:5362) Backport from mainline 2011-07-04 Jakub Jelinek PR rtl-optimization/49619 * combine.c (combine_simplify_rtx): In PLUS -> IOR simplification pass VOIDmode as op0_mode to recursive call. * gcc.dg/pr49619.c: New test. From-SVN: r176485 --- gcc/ChangeLog | 6 ++++++ gcc/combine.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr49619.c | 13 +++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr49619.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ceede27601ca..f653e9405855 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2011-07-19 Jakub Jelinek Backport from mainline + 2011-07-04 Jakub Jelinek + + PR rtl-optimization/49619 + * combine.c (combine_simplify_rtx): In PLUS -> IOR simplification + pass VOIDmode as op0_mode to recursive call. + 2011-05-27 Jakub Jelinek PR c++/49165 diff --git a/gcc/combine.c b/gcc/combine.c index 42a465ecc58e..d1ee51c84832 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4983,7 +4983,7 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) { /* Try to simplify the expression further. */ rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); - temp = combine_simplify_rtx (tor, mode, in_dest); + temp = combine_simplify_rtx (tor, VOIDmode, in_dest); /* If we could, great. If not, do not go ahead with the IOR replacement, since PLUS appears in many special purpose diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 153a20c6d3e2..4c256de8369f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2011-07-19 Jakub Jelinek Backport from mainline + 2011-07-04 Jakub Jelinek + + PR rtl-optimization/49619 + * gcc.dg/pr49619.c: New test. + 2011-05-27 Jakub Jelinek PR c++/49165 diff --git a/gcc/testsuite/gcc.dg/pr49619.c b/gcc/testsuite/gcc.dg/pr49619.c new file mode 100644 index 000000000000..d0a72a6edd19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr49619.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/49619 */ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-fre" } */ + +extern int a, b; + +void +foo (int x) +{ + a = 2; + b = 0; + b = (a && ((a = 1, 0 >= b) || (short) (x + (b & x)))); +} -- 2.47.2