https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70602

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The following patch fixes this:
--- gcc/tree-sra.c      (revision 234833)
+++ gcc/tree-sra.c      (working copy)
@@ -2743,6 +2743,9 @@ generate_subtree_copies (struct access *
                         gimple_stmt_iterator *gsi, bool write,
                         bool insert_after, location_t loc)
 {
+  /* Never write anything into constant pool decls.  */
+  if (!write && constant_decl_p (agg))
+    return;
   do
     {
       if (chunk_size && access->offset >= start_offset + chunk_size)
but I wonder if it just isn't a band-aid.  Though, from what I remember about
SRA, when there are gaps it sometimes just does this weird copying there and
back.  Martin, your thoughts on this?

Reply via email to