[flang] Relax ALLOCATABLE/POINTER actual argument checks under INTENT(IN)
authorPeter Klausler <pklausler@nvidia.com>
Wed, 31 May 2023 21:06:22 +0000 (14:06 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Fri, 2 Jun 2023 15:06:20 +0000 (08:06 -0700)
commit9299bde9e3797db3e46938eb7a53191826fb19c1
treea4d7a285175bfeaf432ff188cbc993fff0de1fce
parent24231df9b8ef560cc6d3c713d5dba1de703e2cb9
[flang] Relax ALLOCATABLE/POINTER actual argument checks under INTENT(IN)

Per 15.5.2.5 p2, when both a dummy data object and its associated
actual argument are ALLOCATABLE or POINTER, there are rules requiring
that both be unlimited polymorphic if either is, and that both be
polymorphic if either is.  The justifications for the first restriction
is that the called procedure might change the type of an unlimited
polymorphic dummy argument, but as this cannot occur for a dummy
argument with INTENT(IN), we can relax the check to an optional
portability warning.  The justification for the second restriction
is that some implementations would have to create a type descriptor
to associate a monomorphic allocatable/pointer actual argument with
a polymorphic dummy argument, and that doesn't apply to f18 since we
use descriptors for them anyways.

Relaxing these needless checks allows more library procedures to
use "class(*), dimension(..), pointer, intent(in)" dummy arguments
in explicit interfaces.

Differential Revision: https://reviews.llvm.org/D151941
flang/include/flang/Common/Fortran-features.h
flang/lib/Semantics/check-call.cpp
flang/test/Semantics/call36.f90 [new file with mode: 0644]