On Fri, Jul 11, 2008 at 7:22 PM, Olivier Hainque <[EMAIL PROTECTED]> wrote: > 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 ?
Yes. > (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 ? For static storage yes, which it seems to test: else if (TREE_CODE (rhs) == VAR_DECL && TREE_STATIC (rhs) && TREE_READONLY (rhs) && targetm.binds_local_p (rhs)) fns->init (lhs_elt, DECL_INITIAL (rhs), bsi); Richard.