> > Sure. Still currently TREE_ADDRESSABLE on TREE_PUBLIC/DECL_EXTERNAL > > VAR_DECLs carries no useful information, so I consider the bit unused. > > I guess that's true for the middle-end in non-LTO mode at this point. > But then the new approach shouldn't be make correctness depend on its setting > in the front-ends, that's too error-prone IMO. > > > I propose to add semantics for it. > > Fine with me, as long as it's centralized somewhere in the middle-end.
If we want to give frontends a way to pass information that address of a given global object is not taken (apparently useful for Ada and its alias attribute), then I do not think we are looking for middle-end only solution. If we really do not want to revisit TREE_ADDRESSABLE in frontends, we can do the following: 1) change semantics of addressable flag on global variables in a way Richard did, document it is initialized only after symbol table is built 2) add code to cgraph construction to set TREE_ADDRESSABLE on every global variable it sees. IPA visibility is run before early optimizations. I suppose we can set it there. I.e. in function_and_variable_visibility whenever we set externally_visible and we have !in_lto_p It is bit of hack. 3) perhaps add some way to avoid 2) on objects we want - apparenlty we now have DECL_NONALIASED that may be useful for this. Honza