Skip to content

Commit 0c1d3e6

Browse files
Thirumalai-Shaktivelcertik
authored andcommitted
[LLVM] Handle CPtr intent::Out argument
1 parent 3c6c19f commit 0c1d3e6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7766,9 +7766,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
77667766
if (llvm_symtab.find(h) != llvm_symtab.end()) {
77677767
tmp = llvm_symtab[h];
77687768
if( !ASRUtils::is_array(arg->m_type) ) {
7769-
77707769
if (x_abi == ASR::abiType::Source && ASR::is_a<ASR::CPtr_t>(*arg->m_type)) {
7771-
if (arg->m_intent == intent_local) {
7770+
if ( orig_arg_intent != ASRUtils::intent_out &&
7771+
arg->m_intent == intent_local ) {
77727772
// Local variable of type
77737773
// CPtr is a void**, so we
77747774
// have to load it
@@ -7815,9 +7815,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
78157815
}
78167816
}
78177817
} else if (is_a<ASR::CPtr_t>(*arg_type)) {
7818-
if (arg->m_intent == intent_local) {
7819-
// Local variable of type
7820-
// CPtr is a void**, so we
7818+
if ( arg->m_intent == intent_local ||
7819+
arg->m_intent == ASRUtils::intent_out) {
7820+
// Local variable or Dummy out argument
7821+
// of type CPtr is a void**, so we
78217822
// have to load it
78227823
tmp = CreateLoad(tmp);
78237824
}

0 commit comments

Comments
 (0)