Skip to content

Commit b1b4a2f

Browse files
Vipul-Cariappaubaidsk
authored andcommitted
fix array symbol duplication in interactive mode
1 parent e5308f1 commit b1b4a2f

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
@@ -2738,9 +2738,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
27382738
llvm::StructType* array_type = static_cast<llvm::StructType*>(
27392739
llvm_utils->get_type_from_ttype_t_util(x.m_type, module.get()));
27402740
llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name, array_type);
2741-
module->getNamedGlobal(x.m_name)->setInitializer(
2742-
llvm::ConstantStruct::get(array_type,
2743-
llvm::Constant::getNullValue(array_type)));
2741+
if (!external) {
2742+
module->getNamedGlobal(x.m_name)->setInitializer(
2743+
llvm::ConstantStruct::get(array_type,
2744+
llvm::Constant::getNullValue(array_type)));
2745+
}
27442746
llvm_symtab[h] = ptr;
27452747
} else if (x.m_type->type == ASR::ttypeType::Logical) {
27462748
llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name,

0 commit comments

Comments
 (0)