[flang-commits] [flang] ab89c13 - [flang] Add lowering TODO for separate module procedures

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Thu Jun 23 05:58:09 PDT 2022


Author: Valentin Clement
Date: 2022-06-23T14:57:58+02:00
New Revision: ab89c132b547951945788fc2a0969cf64b0df4cd

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

LOG: [flang] Add lowering TODO for separate module procedures

MODULE FUNCTION and MODULE SUBROUTINE currently cause lowering crash:
"symbol is not mapped to any IR value" because special care is needed
to handle their interface.

Add a TODO for now.

Example of program that crashed and will hit the TODO:

```
module mod
  interface
    module subroutine sub
    end subroutine
  end interface
contains
  module subroutine sub
    x = 42
  end subroutine
end module
```

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128412

Co-authored-by: Jean Perier <jperier at nvidia.com>

Added: 
    

Modified: 
    flang/lib/Lower/Bridge.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 3ac788e0e6945..facd6640a2fee 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2839,10 +2839,10 @@ class FirConverter : public Fortran::lower::AbstractConverter {
     if (!funit.isMainProgram()) {
       const Fortran::semantics::Symbol &procSymbol =
           funit.getSubprogramSymbol();
-      if (procSymbol.owner().IsSubmodule()) {
+      if (procSymbol.owner().IsSubmodule())
         TODO(toLocation(), "support for submodules");
-        return;
-      }
+      if (Fortran::semantics::IsSeparateModuleProcedureInterface(&procSymbol))
+        TODO(toLocation(), "separate module procedure");
     }
     setCurrentPosition(funit.getStartingSourceLoc());
     for (int entryIndex = 0, last = funit.entryPointList.size();


        


More information about the flang-commits mailing list