[flang-commits] [PATCH] D134403: [flang] A separate module procedure must inherit interface attributes

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 21 17:46:35 PDT 2022


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

Attributes like PURE, ELEMENTAL, &c. are specified on the interface of
a separate module procedure, so when the MODULE PROCEDURE is defined in
a submodule, it must acquire those attributes from the interface.


https://reviews.llvm.org/D134403

Files:
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/separate-mp02.f90


Index: flang/test/Semantics/separate-mp02.f90
===================================================================
--- flang/test/Semantics/separate-mp02.f90
+++ flang/test/Semantics/separate-mp02.f90
@@ -298,3 +298,16 @@
     real :: x
   end
 end
+
+module m8
+  interface
+    pure elemental module subroutine s1
+    end subroutine
+  end interface
+end module
+submodule(m8) sm8
+ contains
+  !Ensure no spurious error about mismatching attributes
+  module procedure s1
+  end procedure
+end submodule
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -3644,6 +3644,7 @@
       currScope().erase(symbol->name());
       newDetails.set_result(*currScope().CopySymbol(details.result()));
     }
+    newSymbol.attrs() |= symbol->attrs();
   }
   return true;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134403.462054.patch
Type: text/x-patch
Size: 915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220922/b90f9869/attachment.bin>


More information about the flang-commits mailing list