]> 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>
Mon, 25 Jun 2018 17:53:06 +0000 (19:53 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:53:06 +0000 (19:53 +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: r262100

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

index be59bb0fdc204d722d4265aee8f10b3950d17c4f..46c2423d2c6ae473d017af3d880fc9ff751b3b7a 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-25  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 236db059ca3874b7599ee3aba9882b7704e7418f..df9ac81b6c976f8ee3b414570eedee7070cd94e0 100644 (file)
@@ -4959,7 +4959,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 8d072f2fc9195360d01634805447d366934c2302..5879011da3b950ec66fb6ba0b105f0881810d6a9 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       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