On Thu, May 5, 2011 at 11:23 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> 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"). > > You need to expand the initializer exactly once and you need to make sure that > this occurrence is invoked before all the others at run time. Not trivial.
But where do you expand it without the SAVE_EXPR? The same restrictions apply there. So I suppose you expand it to a function in which case there is the context where the SAVE_EXPR can be expanded exactly once. If you expand it (the "global" expr without SAVE_EXPR) in multiple function contexts then I see no difference if you have a SAVE_EXPR and expand that once per such function context. Yes, this multiple-times expanding a SAVE_EXPR might not actually work right now, but it doesn't sound like this would be not fixable (mark the original SAVE_EXPR as global, during unsharing make them local and process as usual). But maybe I'm confused and simply lack an actual testcase that shows the issue ;) Richard.