]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/85945 (ICE in resolve_subreg_use, at lower-subreg.c:751)
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 21:29:24 +0000 (23:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:29:24 +0000 (23:29 +0200)
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.

From-SVN: r261967

gcc/ChangeLog
gcc/lower-subreg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr85945.c [new file with mode: 0644]

index 28fe85fdfc2b853b9602d861f7fb13176acd2c78..739717cea2a08bc1cd38141765818003b6e3bbb9 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        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.
+
        2018-06-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/86025
index a4dcec51bb563a75db52f24d4ef2f6b7f3c05b90..b1e2e287e1545d7beecdde5c00ab5b68087aa385 100644 (file)
@@ -490,7 +490,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 ();
index e0d1544a7a4a878d910601483a91dad2dfa55bfe..f8f71ea5da004a0456ddb933a559b215c5dbf719 100644 (file)
@@ -6,6 +6,11 @@
        PR c++/85662
        * g++.dg/ext/offsetof3.C: New test.
 
+       2018-06-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/85945
+       * gcc.c-torture/compile/pr85945.c: New test.
+
        2018-06-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/86025
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85945.c b/gcc/testsuite/gcc.c-torture/compile/pr85945.c
new file mode 100644 (file)
index 0000000..93b2023
--- /dev/null
@@ -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];
+}