Skip to content

Commit

Permalink
Merge pull request lcompilers#2421 from anutosh491/remove_return
Browse files Browse the repository at this point in the history
Removed redundant return node after processing an ASR through subroutine_from_function pass
  • Loading branch information
certik committed Nov 12, 2023
2 parents 64b1391 + 9be1a26 commit b34bcc1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libasr/pass/pass_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,14 @@ namespace LCompilers {
s_func_type->m_arg_types = arg_types.p;
s_func_type->n_arg_types = arg_types.n;
s_func_type->m_return_var_type = nullptr;

Vec<ASR::stmt_t*> func_body;
func_body.reserve(al, x->n_body - 1);
for (size_t i=0; i< x->n_body - 1; i++) {
func_body.push_back(al, x->m_body[i]);
}
x->m_body = func_body.p;
x->n_body = func_body.n;
}
}
for (auto &item : x->m_symtab->get_scope()) {
Expand Down

0 comments on commit b34bcc1

Please sign in to comment.