@@ -19288,12 +19288,27 @@ Lower an stmk_return statement.
1928819288 } /* if */
1928919289 if (any_cleanup_on_return) {
1929019290 /* Generate any cleanup actions required on exit from the routine. */
19291- if (make_block) {
19292- /* Turn the return into a block so that code can be inserted
19293- in front of the return. */
19294- turn_branch_into_block(statement, &insert_location, &return_statement);
19295- } /* if */
19296- gen_cleanup_actions(innermost_function_scope->lifetime, &insert_location);
19291+ { Value_saver<a_source_position> saved_code_pos(&code_pos_for_lowering);
19292+ Value_saver<a_source_position> saved_error_position(&error_position);
19293+
19294+ if (statement->compiler_generated && statement->position.seq == 0) {
19295+ a_statement_ptr assoc_block = innermost_function_scope->assoc_block;
19296+ if (assoc_block != NULL &&
19297+ assoc_block->kind == stmk_block &&
19298+ assoc_block->variant.block.extra_info->final_position.seq != 0) {
19299+ code_pos_for_lowering = assoc_block->variant.block.extra_info
19300+ ->final_position;
19301+ error_position = code_pos_for_lowering;
19302+ } /* if */
19303+ } /* if */
19304+ if (make_block) {
19305+ /* Turn the return into a block so that code can be inserted
19306+ in front of the return. */
19307+ turn_branch_into_block(statement, &insert_location, &return_statement);
19308+ } /* if */
19309+ gen_cleanup_actions(innermost_function_scope->lifetime,
19310+ &insert_location);
19311+ }
1929719312 reset_cleanup_state_at_transfer_of_control(return_statement, statement);
1929819313 } /* if */
1929919314 /* Maintain a list of all returns in the routine so that epilogue code
0 commit comments