On 03/06/2015 01:46 PM, Jason Merrill wrote:
On 03/06/2015 11:19 AM, Aldy Hernandez wrote:
We are hitting the MODIFY_EXPR case. Indeed, _because_ we hit the
MODIFY_EXPR is that we return the uninitialized temporary.
For example, we start with:
return retval = TARGET_EXPR <D.2347, ...>
which becomes:
<stuff with &D.2347>
return D.2349 = D.2347;
which the aforementioned MODIFY_EXPR case turns into:
<stuff with &D.2347>
return D.2349;
But doesn't this still involve a MODIFY_EXPR, i.e. return retval = D.2349?
If I understand you correct, no.
gimplify_return_expr creates a new temporary and uses that instead of
<retval>:
else if (gimplify_ctxp->return_temp)
result = gimplify_ctxp->return_temp;
else
{
result = create_tmp_reg (TREE_TYPE (result_decl));
...
}
...
...
/* Smash the lhs of the MODIFY_EXPR to the temporary we plan to use.
Then gimplify the whole thing. */
if (result != result_decl)
TREE_OPERAND (ret_expr, 0) = result;
Aldy