diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -3664,6 +3664,7 @@ 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 --- a/flang/test/Semantics/separate-mp02.f90 +++ b/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