On Wed, May 4, 2011 at 7:14 PM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Actually it turns out that it doesn't matter. If we arrive here with >> something that needs a SAVE_EXPR we have to be able to generate code >> for it somewhere, where there would be obviously the possibility to >> also generate code for a SAVE_EXPR. > > The transformations done in fold are optimizations that duplicate things, > hence the need to protect them from multiple evaluations. If you cannot > easily do so (e.g. at global level), you just don't do the optimizations. > > But, yes, there is something true. If you have variable sizes at the global > level, they need to be evaluated once for all (unless self-referential, but > this is another subject) so you need to do it somewhere. But you cannot do > it with SAVE_EXPRs since they would end up being shared across functions.
Sure, but that's a limitation of out SAVE_EXPR handling (given that it would be ok to expand the SAVE_EXPR multiple times - once per "instantiation context"). Richard. > -- > Eric Botcazou >