aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharishch4 <harishcse44@gmail.com>2024-03-19 22:46:57 +0530
committerGitHub <noreply@github.com>2024-03-19 22:46:57 +0530
commita7eaae4ec686ddfb8f91868fc8d053b2163f7ec7 (patch)
tree11ce0536e776ea3e5c1773c27838dbb55bcc677a
parentfe84369cc6759194e006f3f624a064bce13c84d4 (diff)
downloadllvm-a7eaae4ec686ddfb8f91868fc8d053b2163f7ec7.zip
llvm-a7eaae4ec686ddfb8f91868fc8d053b2163f7ec7.tar.gz
llvm-a7eaae4ec686ddfb8f91868fc8d053b2163f7ec7.tar.bz2
[Flang] Fix to the module procedure interface block ignoring implicit… (#85735)
… of host scoping unit. Fix as proposed by @thtsikas [here ](https://github.com/llvm/llvm-project/commit/11d07d9ef618497b825badee8b4f06a48575606b#commitcomment-139798026).
-rw-r--r--flang/lib/Semantics/resolve-names.cpp2
-rw-r--r--flang/test/Semantics/separate-mp05.f906
2 files changed, 5 insertions, 3 deletions
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index b136745..f89323f 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -4432,7 +4432,7 @@ Symbol &SubprogramVisitor::PushSubprogramScope(const parser::Name &name,
CHECK(context().HasError(genericSymbol));
}
}
- set_inheritFromParent(false);
+ set_inheritFromParent(hasModulePrefix);
}
if (Symbol * found{FindSymbol(name)};
found && found->has<HostAssocDetails>()) {
diff --git a/flang/test/Semantics/separate-mp05.f90 b/flang/test/Semantics/separate-mp05.f90
index 5b7e252..ad00214 100644
--- a/flang/test/Semantics/separate-mp05.f90
+++ b/flang/test/Semantics/separate-mp05.f90
@@ -7,8 +7,10 @@ module m
!DEF: /m/smp MODULE, PUBLIC, PURE (Function) Subprogram REAL(4)
!DEF: /m/smp/f EXTERNAL, PURE (Function) Subprogram REAL(4)
!DEF: /m/smp/x INTENT(IN) ObjectEntity REAL(4)
- !DEF: /m/smp/res (Implicit) ObjectEntity REAL(4)
+ !DEF: /m/smp/res ObjectEntity REAL(4)
pure module function smp(f, x) result(res)
+ !REF: /m/smp/res
+ real res
interface
!REF: /m/smp/f
!DEF: /m/smp/f/x INTENT(IN) ObjectEntity REAL(4)
@@ -32,7 +34,7 @@ submodule (m)sm
contains
!DEF: /m/sm/smp MODULE, PUBLIC, PURE (Function) Subprogram REAL(4)
module procedure smp
- !DEF: /m/sm/smp/res (Implicit) ObjectEntity REAL(4)
+ !DEF: /m/sm/smp/res ObjectEntity REAL(4)
!DEF: /m/sm/smp/f EXTERNAL, PURE (Function) Subprogram REAL(4)
!DEF: /m/sm/smp/x INTENT(IN) ObjectEntity REAL(4)
res = f(x)