Skip to content

Commit 7d147fb

Browse files
authored
Merge pull request #2185 from Shaikh-Ubaid/fix_failing_ci_test
C_CPP: Visit the expression in construct_call_args()
2 parents 31d3a29 + 50c43ff commit 7d147fb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/libasr/codegen/asr_to_c_cpp.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,18 +1034,17 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) {
10341034
bracket_open++;
10351035
std::string args = "";
10361036
for (size_t i=0; i<n_args; i++) {
1037+
self().visit_expr(*m_args[i].m_value);
1038+
ASR::ttype_t* type = ASRUtils::expr_type(m_args[i].m_value);
10371039
if (ASR::is_a<ASR::Var_t>(*m_args[i].m_value)) {
1038-
ASR::Variable_t *arg = ASRUtils::EXPR2VAR(m_args[i].m_value);
1039-
std::string arg_name = arg->m_name;
1040-
if( ASRUtils::is_array(arg->m_type) &&
1041-
ASRUtils::is_pointer(arg->m_type) ) {
1042-
args += "&" + arg_name;
1040+
if( ASRUtils::is_array(type) &&
1041+
ASRUtils::is_pointer(type) ) {
1042+
args += "&" + src;
10431043
} else {
1044-
args += arg_name;
1044+
args += src;
10451045
}
10461046
} else {
1047-
self().visit_expr(*m_args[i].m_value);
1048-
if( ASR::is_a<ASR::Struct_t>(*ASRUtils::expr_type(m_args[i].m_value)) ) {
1047+
if( ASR::is_a<ASR::Struct_t>(*type) ) {
10491048
args += "&" + src;
10501049
} else {
10511050
args += src;

0 commit comments

Comments
 (0)