aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r--gcc/c-semantics.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 6a963a9..eca64ba 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -460,7 +460,15 @@ void
genrtl_return_stmt (stmt)
tree stmt;
{
- tree expr = RETURN_EXPR (stmt);
+ tree expr;
+
+ /* If RETURN_NULLIFIED_P is set, the frontend has arranged to set up
+ the return value separately, so just return the return value
+ itself. This is used for the C++ named return value optimization. */
+ if (RETURN_NULLIFIED_P (stmt))
+ expr = DECL_RESULT (current_function_decl);
+ else
+ expr = RETURN_EXPR (stmt);
emit_line_note (input_filename, lineno);
if (!expr)