In the case of a function, the new expansion of contracts makes use of an extended return statement to store the result of the function in the return object while the post-conditions are evaluated. Unfortunately GNAT does not elide the copy of the return object for extended return statements for the time being, so this scheme incurs an extra copy of the return value on the primary or secondary stack, as well as an additional pair of calls to Adjust/Finalize when the return type needs finalization. This temporarily changes the expansion to use a block statement containing a renaming, which does not incur the extra copy provided that it is manually adjusted to be recognized by the existing "tail call" optimization present in the Expand_Simple_Function_Return routine. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb (uild_Subprogram_Contract_Wrapper): Remove useless local variable. In the case of a function, replace the extended return statement by a block statement declaring a renaming of the call to the local subprogram after removing side effects manually. (Expand_Subprogram_Contract): Adjust description accordingly. * exp_ch6.adb (Expand_Ctrl_Function_Call): Rewrite obsolete comment and do not apply the transformation twice. * sem_attr.adb (Analyze_Attribute_Old_Result): Now expect a block statement instead of an extended return statement.