Skip to content

Commit

Permalink
Avoid double initialisation in LLVM as well
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 committed Jan 20, 2023
1 parent 1ed52da commit 69fada8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2893,7 +2893,19 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
fill_array_details_(ptr, m_dims, n_dims,
is_malloc_array_type,
is_array_type, is_list, v->m_type);
if( v->m_symbolic_value != nullptr &&
ASR::expr_t* init_expr = v->m_symbolic_value;
if( !ASR::is_a<ASR::Const_t>(*v->m_type) ) {
for( size_t i = 0; i < v->n_dependencies; i++ ) {
std::string variable_name = v->m_dependencies[i];
ASR::symbol_t* dep_sym = x.m_symtab->resolve_symbol(variable_name);
if( (dep_sym && ASR::is_a<ASR::Variable_t>(*dep_sym) &&
!ASR::down_cast<ASR::Variable_t>(dep_sym)->m_symbolic_value) ) {
init_expr = nullptr;
break;
}
}
}
if( init_expr != nullptr &&
!ASR::is_a<ASR::List_t>(*v->m_type)) {
target_var = ptr;
tmp = nullptr;
Expand Down

0 comments on commit 69fada8

Please sign in to comment.