re PR middle-end/89412 (gcc ICE in simplify_subreg, at simplify-rtx.c:6273 on i686...
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Feb 2019 23:02:29 +0000 (00:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 20 Feb 2019 23:02:29 +0000 (00:02 +0100)
PR middle-end/89412
* expr.c (expand_assignment): If result is a MEM, use change_address
instead of simplify_gen_subreg.

* gcc.c-torture/compile/pr89412.c: New test.

From-SVN: r269057

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr89412.c [new file with mode: 0644]

index aba3eb8419d318a0b4d4c0e429aed4de2b0821f0..fe3140363cd01e21647c42d4c365c2e816b22e26 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/89412
+       * expr.c (expand_assignment): If result is a MEM, use change_address
+       instead of simplify_gen_subreg.
+
 2019-02-20  Jakub Jelinek  <jakub@redhat.com>
            David Malcolm  <dmalcolm@redhat.com>
 
index ce71ae710898444ea34b491ac6a98f8e25e01295..9ff5e5f2d76b36ed65c51601a0fa800d0600b92a 100644 (file)
@@ -5211,9 +5211,13 @@ expand_assignment (tree to, tree from, bool nontemporal)
                }
              else
                {
-                 rtx from_rtx
-                   = simplify_gen_subreg (to_mode, result,
-                                          TYPE_MODE (TREE_TYPE (from)), 0);
+                 rtx from_rtx;
+                 if (MEM_P (result))
+                   from_rtx = change_address (result, to_mode, NULL_RTX);
+                 else
+                   from_rtx
+                     = simplify_gen_subreg (to_mode, result,
+                                            TYPE_MODE (TREE_TYPE (from)), 0);
                  if (from_rtx)
                    {
                      emit_move_insn (XEXP (to_rtx, 0),
index 353e4d704a746e4b501d2df0922f797219d1d6ee..32a68cc71f4ef9202c909e70e48fa8b6f1ea4ded 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/89412
+       * gcc.c-torture/compile/pr89412.c: New test.
+
 2019-02-20  Jakub Jelinek  <jakub@redhat.com>
            David Malcolm  <dmalcolm@redhat.com>
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr89412.c b/gcc/testsuite/gcc.c-torture/compile/pr89412.c
new file mode 100644 (file)
index 0000000..0d6ddd5
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR middle-end/89412 */
+
+struct S { double a, b; } d;
+int e;
+double f;
+
+void
+foo ()
+{
+  _Complex double h;
+  while (e)
+    {
+      f = h;
+      *(struct S *) &h = d;
+    }
+}