> Hmm, it looks to me that the IPA analysis marking the variable readonly > in the first place is wrong - or that NRV may not be applied to such a > variable later. Is NRV ever applied to say > > static const S s = ...; > > s = foo (); > > thus a readonly declared LHS?
But NRV is only an example and not necessary, as you may read a RESULT_DECL in the callee. So the combination is actually just RSO + inlining if the callee happens to read RESULT_DECL. -- Eric Botcazou