[flang-commits] [flang] [Flang] Fix to the module procedure interface block ignoring implicit… (PR #85735)

via flang-commits flang-commits at lists.llvm.org
Tue Mar 19 03:17:42 PDT 2024


https://github.com/harishch4 updated https://github.com/llvm/llvm-project/pull/85735

>From e454c8fe007a08dbfda461c870f1b5fea7e027b6 Mon Sep 17 00:00:00 2001
From: Harish Chambeti <harishcse44 at gmail.com>
Date: Tue, 19 Mar 2024 10:35:08 +0530
Subject: [PATCH] [Flang] Fix to the module procedure interface block ignoring
 implicit of host scoping unit.

---
 flang/lib/Semantics/resolve-names.cpp  | 2 +-
 flang/test/Semantics/separate-mp05.f90 | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index b13674573fe07e..f89323f3e54a62 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 5b7e2523a22866..ad002142fd285e 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 @@ pure function f(x) result(r)
 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)



More information about the flang-commits mailing list