> 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. -- Eric Botcazou