[all-commits] [llvm/llvm-project] 47995a: [flang] catch implicit interface incompatibility w...
jeanPerier via All-commits
all-commits at lists.llvm.org
Wed Feb 9 00:31:44 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 47995a0ec92643f8b799c19103ed2c9222e63221
https://github.com/llvm/llvm-project/commit/47995a0ec92643f8b799c19103ed2c9222e63221
Author: Jean Perier <jperier at nvidia.com>
Date: 2022-02-09 (Wed, 09 Feb 2022)
Changed paths:
M flang/lib/Semantics/expression.cpp
M flang/lib/Semantics/resolve-names.cpp
A flang/test/Semantics/call24.f90
M flang/test/Semantics/resolve89.f90
Log Message:
-----------
[flang] catch implicit interface incompatibility with global scope symbol
Previously, when calling a procedure implicitly for which a global scope
procedure symbol with the same name existed, semantics resolved the
procedure name in the call to the global symbol without checking that
the symbol interface was compatible with the implicit interface of the
call.
This could cause expression rewrite and lowering to later badly process
the implicit call assuming a different result type or an explicit
interface. This could lead to lowering crash in case the actual argument
were incompatible with the dummies from the explicit interface.
Emit errors in the following problematic cases:
- If the result type from the symbol did not match the one from the
implicit interface.
- If the symbol requires an explicit interface.
This patch still allows calling an F77 like procedure with different
actual argument types than the one it was defined with because it is
correctly supported in lowering and is a feature in some program
(it is a pointer cast). The two cases that won't be accepted have
little chance to make much sense. Results returning ABIs may differ
depending on the return types, and function that requires explicit
interface usually requires descriptors or specific processing that
is incompatible with implicit interfaces.
Note that this patch is not making a deep analysis, and it will only
catch mistakes if a global symbol and an implicit interface are
involved. Cases where the user provided a conflicting explicit
interface would still require a pass after name resolution to study
conflicts more deeply. But these cases will not crash lowering or
trigger expression rewrite to do weird things.
Differential Revision: https://reviews.llvm.org/D119274
More information about the All-commits
mailing list