https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80622
--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> --- The simplest fix is the following, but I'll move the whole test a bit earlier in a patch to the mailing list: diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 1606573aead..79ca1666c15 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2581,8 +2581,10 @@ propagate_subaccesses_across_link (struct access *lacc, struct access *racc) /* IF the LHS is still not marked as being written to, we only need to do so if the RHS at this level actually was. */ - if (!lacc->grp_write && - (racc->grp_write || TREE_CODE (racc->base) == PARM_DECL)) + if (!lacc->grp_write + && (racc->grp_write + || TREE_CODE (racc->base) == PARM_DECL + || constant_decl_p (racc->base))) { lacc->grp_write = true; ret = true;