@@ -242,6 +242,7 @@ R"(#include <stdio.h>
242242 if (ASR::is_a<ASR::Variable_t>(*var_sym)) {
243243 ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(var_sym);
244244 std::string decl = self ().convert_variable_decl (*v);
245+ decl = check_tmp_buffer () + decl;
245246 bool used_define_for_const = (ASR::is_a<ASR::Const_t>(*v->m_type ) &&
246247 v->m_intent == ASRUtils::intent_local);
247248 if (used_define_for_const) {
@@ -300,11 +301,12 @@ R"(#include <stdio.h>
300301 ASR::symbol_t * var_sym = x.m_symtab ->get_symbol (item);
301302 if (ASR::is_a<ASR::Variable_t>(*var_sym)) {
302303 ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(var_sym);
303- decl + = self ().convert_variable_decl (*v);
304+ std::string d = self ().convert_variable_decl (*v);
304305 if ( !ASR::is_a<ASR::Const_t>(*v->m_type ) ||
305306 v->m_intent == ASRUtils::intent_return_var ) {
306- decl += " ;\n " ;
307+ d += " ;\n " ;
307308 }
309+ decl += check_tmp_buffer () + d;
308310 }
309311 }
310312
@@ -336,11 +338,12 @@ R"(#include <stdio.h>
336338 ASR::symbol_t * var_sym = block->m_symtab ->get_symbol (item);
337339 if (ASR::is_a<ASR::Variable_t>(*var_sym)) {
338340 ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(var_sym);
339- decl + = indent + self ().convert_variable_decl (*v);
341+ std::string d = indent + self ().convert_variable_decl (*v);
340342 if ( !ASR::is_a<ASR::Const_t>(*v->m_type ) ||
341343 v->m_intent == ASRUtils::intent_return_var ) {
342- decl += " ;\n " ;
344+ d += " ;\n " ;
343345 }
346+ decl += check_tmp_buffer () + d;
344347 }
345348 }
346349 for (size_t i=0 ; i<block->n_body ; i++) {
@@ -539,11 +542,12 @@ R"(#include <stdio.h>
539542 ASR::Variable_t *v = ASR::down_cast<ASR::Variable_t>(var_sym);
540543 if (v->m_intent == ASRUtils::intent_local ||
541544 v->m_intent == ASRUtils::intent_return_var) {
542- decl + = indent + self ().convert_variable_decl (*v);
545+ std::string d = indent + self ().convert_variable_decl (*v);
543546 if ( !ASR::is_a<ASR::Const_t>(*v->m_type ) ||
544547 v->m_intent == ASRUtils::intent_return_var ) {
545- decl += " ;\n " ;
548+ d += " ;\n " ;
546549 }
550+ decl += check_tmp_buffer () + d;
547551 }
548552 if (ASR::is_a<ASR::TypeParameter_t>(*v->m_type )) {
549553 has_typevar = true ;
0 commit comments