@@ -809,7 +809,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
809809 llvm::Type* max_sized_type = nullptr ;
810810 size_t max_type_size = 0 ;
811811 for ( auto itr = scope.begin (); itr != scope.end (); itr++ ) {
812- ASR::Variable_t* member = ASR::down_cast<ASR::Variable_t>(itr->second );
812+ ASR::Variable_t* member = ASR::down_cast<ASR::Variable_t>(ASRUtils::symbol_get_past_external ( itr->second ) );
813813 llvm::Type* llvm_mem_type = getMemberType (member->m_type , member);
814814 size_t type_size = data_layout.getTypeAllocSize (llvm_mem_type);
815815 if ( max_type_size < type_size ) {
@@ -3316,14 +3316,18 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
33163316 ASRUtils::symbol_get_past_external (struct_t ->m_derived_type ));
33173317 std::string struct_type_name = struct_type_t ->m_name ;
33183318 for ( auto item: struct_type_t ->m_symtab ->get_scope () ) {
3319- if ( ASR::is_a<ASR::ClassProcedure_t>(*item.second ) ||
3320- ASR::is_a<ASR::GenericProcedure_t>(*item.second ) ||
3321- ASR::is_a<ASR::UnionType_t>(*item.second ) ||
3322- ASR::is_a<ASR::StructType_t>(*item.second ) ||
3323- ASR::is_a<ASR::CustomOperator_t>(*item.second ) ) {
3319+ ASR::symbol_t *sym = ASRUtils::symbol_get_past_external (item.second );
3320+ if (name2memidx[struct_type_name].find (item.first ) == name2memidx[struct_type_name].end ()) {
3321+ continue ;
3322+ }
3323+ if ( ASR::is_a<ASR::ClassProcedure_t>(*sym) ||
3324+ ASR::is_a<ASR::GenericProcedure_t>(*sym) ||
3325+ ASR::is_a<ASR::UnionType_t>(*sym) ||
3326+ ASR::is_a<ASR::StructType_t>(*sym) ||
3327+ ASR::is_a<ASR::CustomOperator_t>(*sym) ) {
33243328 continue ;
33253329 }
3326- ASR::ttype_t * symbol_type = ASRUtils::symbol_type (item. second );
3330+ ASR::ttype_t * symbol_type = ASRUtils::symbol_type (sym );
33273331 int idx = name2memidx[struct_type_name][item.first ];
33283332 llvm::Value* ptr_member = llvm_utils->create_gep (ptr, idx);
33293333 ASR::Variable_t* v = nullptr ;
@@ -8569,7 +8573,7 @@ Result<std::unique_ptr<LLVMModule>> asr_to_llvm(ASR::TranslationUnit_t &asr,
85698573 pass_manager.apply_passes (al, &asr, pass_options, diagnostics);
85708574
85718575 // Uncomment for debugging the ASR after the transformation
8572- // std::cout << LFortran:: pickle(asr, false, false , false) << std::endl;
8576+ // std::cout << LCompilers::LPython:: pickle(asr, true, true , false) << std::endl;
85738577
85748578 try {
85758579 v.visit_asr ((ASR::asr_t &)asr);
0 commit comments