https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112794
--- Comment #1 from Nina Ranns <dinka.ranns at gmail dot com> --- We have a general issue in creating the contract check functions when -fcontract-checks-outlined is used - the arguments of the function, including the return value, are not passed by reference. However, this test case is observing something different. Without outline checks, and with the fix to the above issue, modifications of the return value in a postcondition may still not be observable. Mechanical reason for this is that gimplify_return_expr will create a temporary for the return value when aggregate_value_p is false, and gimplification of the postcondition expression may create another temporary in prepare_gimple_addressable for certain uses of return value object. This second temporary is initialised to the copy of the first temporary and modifications to it are not observable after the function exists. However, I believe this is ok according to https://eel.is/c++draft/expr.call#9 Thoughts ? If this is ok, I have a patch for the outline contract checks.
