- block_stmt_iterator bsi;
-
- offset = 0;
-
- if (bb == ENTRY_BLOCK_PTR->next_bb)
- {
- expanded_location curr_location =
- expand_location (DECL_SOURCE_LOCATION
- (current_function_decl));
- output_location (curr_location.file, curr_location.line,
- &offset, bb);
- }
-
- for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
- {
- tree stmt = bsi_stmt (bsi);
- if (EXPR_HAS_LOCATION (stmt))
- output_location (EXPR_FILENAME (stmt),
- EXPR_LINENO (stmt),
- &offset, bb);
- }
+ tree stmt = bsi_stmt (bsi);
+ if (EXPR_HAS_LOCATION (stmt))
+ output_location (EXPR_FILENAME (stmt), EXPR_LINENO (stmt),
+ &offset, bb);
+ /* Take into account modify statements nested in return
+ produced by C++ NRV transformation. */
+ if (TREE_CODE (stmt) == RETURN_EXPR
+ && TREE_OPERAND (stmt, 0)
+ && TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR
+ && EXPR_HAS_LOCATION (TREE_OPERAND (stmt, 0)))
+ output_location (EXPR_FILENAME (TREE_OPERAND (stmt, 0)),
+ EXPR_LINENO (TREE_OPERAND (stmt, 0)),
+ &offset, bb);
+ }