[PATCH] D100341: [flang] Handle instantiation of procedure pointer components

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 10:19:42 PDT 2021


PeteSteinfeld added inline comments.


================
Comment at: flang/lib/Semantics/type.cpp:299
     }
-    newScope.set_instantiationContext(contextMessage);
   }
----------------
klausler wrote:
> Why is the scope's instantiation context no longer needing to be set?  Are you somehow setting it elsewhere?
My mistake.  I'll put this back.


================
Comment at: flang/lib/Semantics/type.cpp:361
+        // Don't change the type for interfaces based on symbols
+        interface.set_type(*returnType);
+      }
----------------
klausler wrote:
> Are you sure that you're modifying a new ProcInterface created for this procedure pointer component's instantiation, or are you maybe modifying a ProcInterface shared by all instantiation?
When I look at the symbol table dump for a test program, I see an unmodified entry for the original derived type definition and modified entries for the instantiations.  Correct me if I'm wrong, but that says that I'm not modifying the version that's shared by all instantiations.  Note that the `testExtended()` subroutine in resolve105.f90 contains alternating good and band instantiations, and error messages are only produced by the bad instantiations.

Here's a fragment of a symbol table dump of a small test:

```
  MainProgram scope: test size=0 alignment=1
    base: DerivedType components: field
    dependenttype: DerivedType components: dependentfield
    null, INTRINSIC, PURE (Function): ProcEntity
    testdependent (Subroutine): Subprogram ()
    DerivedType scope: base
      field, NOPASS, POINTER (Function): ProcEntity REAL(int(int(kindparam,kind=4),kind=8)) => NULL()
      kindparam: TypeParam type:INTEGER(4) Kind init:4_4
    DerivedType scope: dependenttype
      dependentfield, NOPASS, POINTER (Function): ProcEntity TYPE(base(kindparam=int(kindparam,kind=4))) => NULL()
      kindparam: TypeParam type:INTEGER(4) Kind init:4_4
    Subprogram scope: testdependent size=24 alignment=8
      local size=24 offset=0: ObjectEntity type: TYPE(dependenttype(kindparam=77_4))
      testdependent (Subroutine): HostAssoc
      DerivedType scope: size=24 alignment=8 instantiation of dependenttype(kindparam=77_4)
        dependentfield, NOPASS, POINTER (Function) size=24 offset=0: ProcEntity TYPE(base(kindparam=77_4))
        kindparam: TypeParam type:INTEGER(4) Kind init:77_4
        DerivedType scope: size=24 alignment=8 instantiation of base(kindparam=77_4)
          field, NOPASS, POINTER (Function) size=24 offset=0: ProcEntity REAL(4)
          kindparam: TypeParam type:INTEGER(4) Kind init:77_4

```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100341



More information about the llvm-commits mailing list