Skip to content

Commit

Permalink
Added symbolic_vars_to_omit to handle corner cases
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Sep 24, 2023
1 parent 076b5a0 commit 6038d2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libasr/pass/replace_symbolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
}
std::vector<std::string> symbolic_dependencies;
std::set<ASR::symbol_t*> symbolic_vars_to_free;
std::set<ASR::symbol_t*> symbolic_vars_to_omit;
SymEngine_Stack symengine_stack;

void visit_Function(const ASR::Function_t &x) {
Expand Down Expand Up @@ -94,6 +95,7 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi
func_body.from_pointer_n_copy(al, xx.m_body, xx.n_body);

for (ASR::symbol_t* symbol : symbolic_vars_to_free) {
if (symbolic_vars_to_omit.find(symbol) != symbolic_vars_to_omit.end()) continue;
Vec<ASR::call_arg_t> call_args;
call_args.reserve(al, 1);
ASR::call_arg_t call_arg;
Expand All @@ -119,10 +121,10 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitor<ReplaceSymbolicVisi

ASR::ttype_t *type1 = ASRUtils::TYPE(ASR::make_CPtr_t(al, xx.base.base.loc));
xx.m_type = type1;
symbolic_vars_to_free.insert(ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&xx));
if(xx.m_intent == ASR::intentType::In){
return;
symbolic_vars_to_omit.insert(ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&xx));
}
symbolic_vars_to_free.insert(ASR::down_cast<ASR::symbol_t>((ASR::asr_t*)&xx));

if(xx.m_intent == ASR::intentType::Local){
ASR::ttype_t *type2 = ASRUtils::TYPE(ASR::make_Integer_t(al, xx.base.base.loc, 8));
Expand Down

0 comments on commit 6038d2c

Please sign in to comment.