[flang-commits] [flang] 04e6129 - [flang] Separate module procedure variant

V Donaldson via flang-commits flang-commits at lists.llvm.org
Wed Aug 16 10:07:35 PDT 2023


Author: V Donaldson
Date: 2023-08-16T10:07:07-07:00
New Revision: 04e6129d3243b9ed60ed17048b701b56aa0e7557

URL: https://github.com/llvm/llvm-project/commit/04e6129d3243b9ed60ed17048b701b56aa0e7557
DIFF: https://github.com/llvm/llvm-project/commit/04e6129d3243b9ed60ed17048b701b56aa0e7557.diff

LOG: [flang] Separate module procedure variant

Accept "module procedure" (as well as module function/subroutine)
in a separate module procedure definition, such as "bb1" in:

module mm
  interface
    module subroutine mm1
    end subroutine
  end interface
end module

submodule(mm) bb
  interface
    module subroutine bb1
    end subroutine
  end interface
contains
  module procedure mm1
    call bb1
  end procedure
  module procedure bb1
    print*, 'bb1'
  end procedure
end submodule

  use mm
  call mm1
end

Added: 
    

Modified: 
    flang/lib/Lower/Mangler.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/Mangler.cpp b/flang/lib/Lower/Mangler.cpp
index e61927781e5736..dc0e0a09e6d0e7 100644
--- a/flang/lib/Lower/Mangler.cpp
+++ b/flang/lib/Lower/Mangler.cpp
@@ -136,9 +136,8 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
             if (interface->attrs().test(Fortran::semantics::Attr::MODULE) &&
                 interface->owner().IsSubmodule() && !subpDetails.isInterface())
               interface = subpDetails.moduleInterface();
-            assert(interface && "Separate module procedure must be declared");
-            std::tie(modules, procs, blockId) =
-                ancestors(*interface, scopeBlockIdMap);
+            std::tie(modules, procs, blockId) = ancestors(
+                interface ? *interface : ultimateSymbol, scopeBlockIdMap);
             return fir::NameUniquer::doProcedure(modules, procs, symbolName);
           },
           [&](const Fortran::semantics::ProcEntityDetails &) {


        


More information about the flang-commits mailing list