From: Jakub Jelinek Date: Mon, 25 Jun 2018 17:52:28 +0000 (+0200) Subject: backport: re PR target/85945 (ICE in resolve_subreg_use, at lower-subreg.c:751) X-Git-Tag: releases/gcc-6.5.0~186 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3889154853c1b57848af6b0d6f00e340aced696b;p=thirdparty%2Fgcc.git backport: re PR target/85945 (ICE in resolve_subreg_use, at lower-subreg.c:751) Backported from mainline 2018-06-14 Jakub Jelinek PR target/85945 * lower-subreg.c (find_decomposable_subregs): Don't decompose float subregs of multi-word pseudos unless the float mode has word size. * gcc.c-torture/compile/pr85945.c: New test. From-SVN: r262099 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d162fbcaa42..be59bb0fdc20 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2018-06-25 Jakub Jelinek Backported from mainline + 2018-06-14 Jakub Jelinek + + PR target/85945 + * lower-subreg.c (find_decomposable_subregs): Don't decompose float + subregs of multi-word pseudos unless the float mode has word size. + 2018-05-06 Jakub Jelinek PR c++/85659 diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index f7b3ac4170ec..84d7d871988d 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -489,7 +489,16 @@ find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi) were the same number and size of pieces. Hopefully this doesn't happen much. */ - if (outer_words == 1 && inner_words > 1) + if (outer_words == 1 + && inner_words > 1 + /* Don't allow to decompose floating point subregs of + multi-word pseudos if the floating point mode does + not have word size, because otherwise we'd generate + a subreg with that floating mode from a different + sized integral pseudo which is not allowed by + validate_subreg. */ + && (!FLOAT_MODE_P (GET_MODE (x)) + || outer_size == UNITS_PER_WORD)) { bitmap_set_bit (decomposable_context, regno); iter.skip_subrtxes (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9d590446fc3..8d072f2fc919 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2018-06-25 Jakub Jelinek Backported from mainline + 2018-06-14 Jakub Jelinek + + PR target/85945 + * gcc.c-torture/compile/pr85945.c: New test. + 2018-05-06 Jakub Jelinek PR c++/85659 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85945.c b/gcc/testsuite/gcc.c-torture/compile/pr85945.c new file mode 100644 index 000000000000..93b2023f25cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr85945.c @@ -0,0 +1,16 @@ +/* PR target/85945 */ + +typedef float V __attribute__((vector_size(16))); +union U { V v; float f[4]; }; +int f; +float g[4]; + +void +foo (void) +{ + V d; + union U i; + i.v = d; + for (f = 0; f < 4; f++) + g[f] = i.f[f]; +}