[flang-commits] [flang] 0862349 - [flang] A separate module procedure must inherit interface attributes
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Sep 23 11:43:53 PDT 2022
Author: Peter Klausler
Date: 2022-09-23T11:43:38-07:00
New Revision: 086234927a05860a5f02b60bce02e5d6be7f878a
URL: https://github.com/llvm/llvm-project/commit/086234927a05860a5f02b60bce02e5d6be7f878a
DIFF: https://github.com/llvm/llvm-project/commit/086234927a05860a5f02b60bce02e5d6be7f878a.diff
LOG: [flang] A separate module procedure must inherit interface attributes
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.
Differential Revision: https://reviews.llvm.org/D134403
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/separate-mp02.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 3f56a257c75f..ddf188ff46e2 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -3664,6 +3664,7 @@ bool SubprogramVisitor::BeginMpSubprogram(const parser::Name &name) {
currScope().erase(symbol->name());
newDetails.set_result(*currScope().CopySymbol(details.result()));
}
+ newSymbol.attrs() |= symbol->attrs();
}
return true;
}
diff --git a/flang/test/Semantics/separate-mp02.f90 b/flang/test/Semantics/separate-mp02.f90
index b1f2a0dfb0e2..6d2f8f8d6ab1 100644
--- a/flang/test/Semantics/separate-mp02.f90
+++ b/flang/test/Semantics/separate-mp02.f90
@@ -298,3 +298,16 @@ module subroutine s1(*, x)
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
More information about the flang-commits
mailing list