[PATCH] D119404: [flang] Allow mixed association of procedure pointers and targets

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 12:35:20 PST 2022


PeteSteinfeld added inline comments.


================
Comment at: flang/lib/Evaluate/tools.cpp:977
+    // match.  That's the case if the target procedure has an implicit
+    // interface.  But this case is allowed by several other compilers.
   } else if (!lhsProcedure->HasExplicitInterface() &&
----------------
jeanPerier wrote:
> I agree that nag/gfortran/ifort/nvfortran do not complain if the pointer explicit interface is compatible with an implicit interface (`CanBeCalledViaImplicitInterface()`), but it seems only nvfortran allows the cases where the explicit interface cannot be called via implicit interface. The following program is refused by nag/ifort/gfortran/xlf (and I think we should too, unless they are programs that really needs it):
> 
> ```
> module m
>     interface
>       subroutine requires_explicit_iface(p)
>         real, pointer :: p(:)
>       end subroutine
>     end interface
> contains
> subroutine test
>   procedure(requires_explicit_iface), pointer :: p
>     external :: s_external
>     p => s_external
> end subroutine
> end module
> ```
> 
> So you could still complain here if `!lhsProcedure->CanBeCalledViaImplicitInterface()` IMHO.
Thanks, Jean.  That makes sense.

I'll add some code and a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119404



More information about the llvm-commits mailing list