Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4de1a2

Browse files
fix array symbol duplication in interactive mode
1 parent ec2dfb5 commit b4de1a2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,9 +2693,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
26932693
llvm::StructType* array_type = static_cast<llvm::StructType*>(
26942694
llvm_utils->get_type_from_ttype_t_util(x.m_type, module.get()));
26952695
llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name, array_type);
2696-
module->getNamedGlobal(x.m_name)->setInitializer(
2697-
llvm::ConstantStruct::get(array_type,
2698-
llvm::Constant::getNullValue(array_type)));
2696+
if (!external) {
2697+
module->getNamedGlobal(x.m_name)->setInitializer(
2698+
llvm::ConstantStruct::get(array_type,
2699+
llvm::Constant::getNullValue(array_type)));
2700+
}
26992701
llvm_symtab[h] = ptr;
27002702
} else if (x.m_type->type == ASR::ttypeType::Logical) {
27012703
llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name,

0 commit comments

Comments
 (0)