]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/85878 (ICE in convert_mode_scalar, at expr.c:287)
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 21:30:06 +0000 (23:30 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:30:06 +0000 (23:30 +0200)
Backported from mainline
2018-06-15  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/85878
* expr.c (expand_assignment): Only call store_expr for halves if the
mode is the same.

* gfortran.fortran-torture/compile/pr85878.f90: New test.

From-SVN: r261968

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90 [new file with mode: 0644]

index 739717cea2a08bc1cd38141765818003b6e3bbb9..d34abe05caf91abe3b7c9197ee25c53b0fcc7abc 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-06-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/85878
+       * expr.c (expand_assignment): Only call store_expr for halves if the
+       mode is the same.
+
        2018-06-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/85945
index 9fe4ec91c1ce65453edf36079234469aa928eb72..ee545ce071f06c7d8b0dd266ece0da03ff87aa4f 100644 (file)
@@ -5109,7 +5109,10 @@ expand_assignment (tree to, tree from, bool nontemporal)
              && bitpos == 0
              && bitsize == mode_bitsize)
            result = store_expr (from, to_rtx, false, nontemporal, reversep);
-         else if (bitsize == mode_bitsize / 2
+         else if (COMPLEX_MODE_P (GET_MODE (to_rtx))
+                  && (TYPE_MODE (TREE_TYPE (from))
+                      == GET_MODE_INNER (GET_MODE (to_rtx)))
+                  && bitsize == mode_bitsize / 2
                   && (bitpos == 0 || bitpos == mode_bitsize / 2))
            result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
                                 nontemporal, reversep);
index f8f71ea5da004a0456ddb933a559b215c5dbf719..ea860f4b1f25bbafb92e6b630f11da782866a732 100644 (file)
@@ -6,6 +6,11 @@
        PR c++/85662
        * g++.dg/ext/offsetof3.C: New test.
 
+       2018-06-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/85878
+       * gfortran.fortran-torture/compile/pr85878.f90: New test.
+
        2018-06-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/85945
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90
new file mode 100644 (file)
index 0000000..e52e95f
--- /dev/null
@@ -0,0 +1,8 @@
+! PR middle-end/85878
+
+program pr85878
+  real :: a
+  complex :: c = (2.0, 3.0)
+  print *, c
+  print *, transfer (a, c)
+end