[flang-commits] [PATCH] D134398: [flang] Don't resolve names in derived type definitions to generics

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Sep 23 10:56:50 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG811aafcbf57e: [flang] Don't resolve names in derived type definitions to generics (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134398/new/

https://reviews.llvm.org/D134398

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


Index: flang/test/Semantics/symbol23.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/symbol23.f90
@@ -0,0 +1,42 @@
+! RUN: %python %S/test_symbols.py %s %flang_fc1
+! Regression test of name resolution bug
+!DEF: /m Module
+module m
+ !DEF: /m/base ABSTRACT, PUBLIC DerivedType
+ type, abstract :: base
+ contains
+  !DEF: /m/base/foo Generic
+  !DEF: /m/base/spec DEFERRED ProcBinding
+  generic :: foo => spec
+  !DEF: /m/iface ABSTRACT, PUBLIC (Subroutine) Subprogram
+  !REF: /m/base/spec
+  procedure(iface), deferred :: spec
+ end type
+ abstract interface
+  !REF: /m/iface
+  !DEF: /m/iface/this ObjectEntity CLASS(base)
+  subroutine iface (this)
+   !REF: /m/base
+   import :: base
+   !REF: /m/base
+   !REF: /m/iface/this
+   class(base) :: this
+  end subroutine
+ end interface
+ !REF: /m/base
+ !DEF: /m/ext PUBLIC DerivedType
+ type, extends(base) :: ext
+ contains
+  !DEF: /m/ext/spec ProcBinding
+  !DEF: /m/foo PUBLIC (Subroutine) Subprogram
+  procedure :: spec => foo
+ end type
+contains
+ !REF: /m/foo
+ !DEF: /m/foo/this ObjectEntity CLASS(ext)
+ subroutine foo (this)
+  !REF: /m/ext
+  !REF: /m/foo/this
+  class(ext) :: this
+ end subroutine
+end module
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -2254,6 +2254,7 @@
   if (scope.IsDerivedType()) {
     if (Symbol * symbol{scope.FindComponent(name.source)}) {
       if (!symbol->has<ProcBindingDetails>() &&
+          !symbol->has<GenericDetails>() &&
           !symbol->test(Symbol::Flag::ParentComp)) {
         return Resolve(name, symbol);
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134398.462547.patch
Type: text/x-patch
Size: 1755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220923/9c23d0af/attachment.bin>


More information about the flang-commits mailing list