Richard Guenther wrote: > > Don't set TREE_RO on the decl if !TREE_STATIC, in gigi (we might > > decide it doesn't make sense and document accordingly). > > That would work.
Both doing the thing in gigi and deciding that TREE_RO only makes sense if TREE_STATIC as well ? (I have no strong feeling about it, just asking to make sure I'm getting what you meant) > > Clear TREE_RO in gimplify_decl_expr. We could leave > > DECL_INITIAL there in this case as well. > > This as well. OK. > > Sorry, this part was confused on my side: the issue we had with > > sra was with a static rhs (global Ada constant integer), of value 1, > > marked TREE_RO and without DECL_INITIAL. > > So what happened? The lhs was initialized with 0 instead of 1. > The code in tree-sra looking at DECL_INITIAL looks fine. If it's ok to assume !DECL_INITIAL is equivalent to 0, indeed. Is it really ?