re PR tree-optimization/82838 (ICE in verify_ssa failed w/ store-merging)
authorJakub Jelinek <jakub@redhat.com>
Mon, 6 Nov 2017 16:29:11 +0000 (17:29 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 6 Nov 2017 16:29:11 +0000 (17:29 +0100)
PR tree-optimization/82838
* gimple-ssa-store-merging.c
(imm_store_chain_info::output_merged_store): Call force_gimple_operand_1
on a separate gimple_seq which is then appended to seq.

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

From-SVN: r254457

gcc/ChangeLog
gcc/gimple-ssa-store-merging.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr82838.c [new file with mode: 0644]

index 1cda8a32a7a443dcce10ced4d55ba3705d5d7491..7c04aa9b313180bb1de907bc84a0e1c2d442f8f6 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/82838
+       * gimple-ssa-store-merging.c
+       (imm_store_chain_info::output_merged_store): Call force_gimple_operand_1
+       on a separate gimple_seq which is then appended to seq.
+
 2017-11-06  Jeff Law  <law@redhat.com>
 
        PR target/82788
index 5366a9b6e2907b88dbdac60711644721cc699a87..3c29a5f9e24f0a8e2a1280fd31708d6413815aa5 100644 (file)
@@ -1642,10 +1642,14 @@ imm_store_chain_info::output_merged_store (merged_store_group *group)
       else if (operand_equal_p (base_addr, op.base_addr, 0))
        load_addr[j] = addr;
       else
-       load_addr[j]
-         = force_gimple_operand_1 (unshare_expr (op.base_addr),
-                                   &seq, is_gimple_mem_ref_addr,
-                                   NULL_TREE);
+       {
+         gimple_seq this_seq;
+         load_addr[j]
+           = force_gimple_operand_1 (unshare_expr (op.base_addr),
+                                     &this_seq, is_gimple_mem_ref_addr,
+                                     NULL_TREE);
+         gimple_seq_add_seq_without_update (&seq, this_seq);
+       }
     }
 
   FOR_EACH_VEC_ELT (split_stores, i, split_store)
index de0e0a8ebeeb495d29bfd1f0f524073a917b47dc..edb3797cc1d169e223b7f00a7b7dc165c9a189a2 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/82838
+       * gcc.c-torture/compile/pr82838.c: New test.
+
 2017-11-06  Jeff Law  <law@redhat.com>
 
        PR target/82788
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82838.c b/gcc/testsuite/gcc.c-torture/compile/pr82838.c
new file mode 100644 (file)
index 0000000..a6ca163
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR tree-optimization/82838 */
+
+struct S { unsigned short a, b, c; };
+struct S f[10];
+
+void
+foo (int e)
+{
+  struct S *x;
+  f[e].b = x[e].a;
+  f[e].c = x[e].b;
+}