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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
For the record, the following is the most likely fix, but let me think
about it a bit more tomorrow before I submit it.

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index e4851daaa3f..7efd0a62ebb 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3548,7 +3548,8 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator
*gsi)
              lhs = build_ref_for_model (loc, lhs, 0, racc, gsi, false);
              gimple_assign_set_lhs (stmt, lhs);
            }
-         else if (AGGREGATE_TYPE_P (TREE_TYPE (rhs))
+         else if (lacc
+                  && AGGREGATE_TYPE_P (TREE_TYPE (rhs))
                   && !contains_vce_or_bfcref_p (rhs))
            rhs = build_ref_for_model (loc, rhs, 0, lacc, gsi, false);

Reply via email to