Following causes an ICE: $ s390x-linux-gnu-gcc -c -O1 -march=z13 ice.i during RTL pass: subreg2 ice.i: In function ‘h’: ice.i:16:1: internal compiler error: in resolve_subreg_use, at lower-subreg.c:751 } ^ 0x12512d5 resolve_subreg_use .././../gcc/lower-subreg.c:751 0x125262b decompose_multiword_subregs .././../gcc/lower-subreg.c:1602 0x125315d execute .././../gcc/lower-subreg.c:1741
Where is the testcase?
Is missing :) Here it is: typedef float b; typedef b __attribute__((vector_size(16))) c; typedef union { c d; b a[4]; } e; int f; b g[4]; void h() { c d; e i; i.d = d; f = 0; for (; f < 4; f++) g[f] = i.a[f]; }
I think the problem is that validate_subreg etc. has a restriction like: /* Subregs involving floating point modes are not allowed to change size. Therefore (subreg:DI (reg:DF) 0) is fine, but (subreg:SI (reg:DF) 0) isn't. */ but lower-subreg.c doesn't take that into account in: /* We only try to decompose single word subregs of multi-word registers. When we find one, we return -1 to avoid iterating over the inner register. ??? This doesn't allow, e.g., DImode subregs of TImode values on 32-bit targets. We would need to record the way the pseudo-register was used, and only decompose if all the uses were the same number and size of pieces. Hopefully this doesn't happen much. */ if (outer_words == 1 && inner_words > 1) { bitmap_set_bit (decomposable_context, regno); iter.skip_subrtxes (); continue; } and decompose_register creates concat with a word sized integral pseudos in it.
Created attachment 44198 [details] gcc9-pr85945.patch Untested fix.
Author: jakub Date: Thu Jun 14 13:35:06 2018 New Revision: 261593 URL: https://gcc.gnu.org/viewcvs?rev=261593&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr85945.c Modified: trunk/gcc/ChangeLog trunk/gcc/lower-subreg.c trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Thu Jun 14 13:36:43 2018 New Revision: 261594 URL: https://gcc.gnu.org/viewcvs?rev=261594&root=gcc&view=rev Log: 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. Added: branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/pr85945.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/lower-subreg.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Fixed for 8.2+ so far.
Author: jakub Date: Fri Jun 22 21:29:24 2018 New Revision: 261967 URL: https://gcc.gnu.org/viewcvs?rev=261967&root=gcc&view=rev Log: Backported from mainline 2018-06-14 Jakub Jelinek <jakub@redhat.com> 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. Added: branches/gcc-7-branch/gcc/testsuite/gcc.c-torture/compile/pr85945.c Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/lower-subreg.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Author: jakub Date: Mon Jun 25 17:52:28 2018 New Revision: 262099 URL: https://gcc.gnu.org/viewcvs?rev=262099&root=gcc&view=rev Log: Backported from mainline 2018-06-14 Jakub Jelinek <jakub@redhat.com> 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. Added: branches/gcc-6-branch/gcc/testsuite/gcc.c-torture/compile/pr85945.c Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/lower-subreg.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Fixed for 6.5 and 7.4+ too.