Skip to content

Commit

Permalink
Merge pull request #2329 from Shaikh-Ubaid/changes_from_lfortran
Browse files Browse the repository at this point in the history
C: Fix passing array elements as reference
  • Loading branch information
Shaikh-Ubaid authored Sep 19, 2023
2 parents 0a5d89b + 5253174 commit 5569d74
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,14 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) {
} else {
args += src;
}
} else if (ASR::is_a<ASR::ArrayItem_t>(*m_args[i].m_value)) {
ASR::Variable_t* param = ASRUtils::EXPR2VAR(f->m_args[i]);
if (param->m_intent == ASRUtils::intent_inout
|| param->m_intent == ASRUtils::intent_out || ASR::is_a<ASR::Struct_t>(*type)) {
args += "&" + src;
} else {
args += src;
}
} else {
if( ASR::is_a<ASR::Struct_t>(*type) ) {
args += "&" + src;
Expand Down

0 comments on commit 5569d74

Please sign in to comment.