[flang] Check discrepancies between local & available global subprograms
authorPeter Klausler <pklausler@nvidia.com>
Thu, 1 Dec 2022 00:11:20 +0000 (16:11 -0800)
committerPeter Klausler <pklausler@nvidia.com>
Fri, 2 Dec 2022 19:11:31 +0000 (11:11 -0800)
commit0d588347000bd8245b8a1824758c6ed005ae5bce
treea2e04d6bc0fed01a034bfe6f3f8f5293fa2cc107
parent2af2e4dbb790daafd3cbbf6189a7a27145cf4c12
[flang] Check discrepancies between local & available global subprograms

When a scope declares the name and perhaps some characteristics of
an external subprogram using any of the many means that Fortran supplies
for doing such a thing, and that external subprogram's definition is
available, check the local declaration against the external definition.
In particular, if the global definition's interface cannot be called
by means of an implicit interface, ensure that references are via an
explicit and compatible interface.

Further, extend call site checking so that when a local declaration
exists for a known global symbol and the arguments are valid for that
local declaration, the arguments are checked against the global's
interface, just are is already done when no local declaration exists.

Differential Revision: https://reviews.llvm.org/D139042
15 files changed:
flang/include/flang/Semantics/symbol.h
flang/include/flang/Semantics/tools.h
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/check-call.cpp
flang/lib/Semantics/check-call.h
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/expression.cpp
flang/lib/Semantics/symbol.cpp
flang/lib/Semantics/tools.cpp
flang/test/Semantics/global01.f90 [new file with mode: 0644]
flang/test/Semantics/local-vs-global.f90 [new file with mode: 0644]
flang/test/Semantics/procinterface01.f90
flang/test/Semantics/resolve102.f90
flang/test/Semantics/resolve53.f90
flang/test/Semantics/resolve62.f90