[flang] Correct actual/dummy procedure compatibility for ALLOCATABLE/POINTER functions

Functions returning ALLOCATABLE or POINTER arrays have descriptor inquiries in
their results' shape expressions that won't compare equal.  These functions
need only be checked for compatible ranks (& of course other characteristics).

Differential Revision: https://reviews.llvm.org/D125123
This commit is contained in:
Peter Klausler 2022-05-03 09:28:04 -07:00
parent 6f14dbedd9
commit 948d0b340b
1 changed files with 4 additions and 1 deletions

View File

@ -788,7 +788,10 @@ bool FunctionResult::IsCompatibleWith(const FunctionResult &actual) const {
return false;
} else if (const auto *ifaceTypeShape{std::get_if<TypeAndShape>(&u)}) {
if (const auto *actualTypeShape{std::get_if<TypeAndShape>(&actual.u)}) {
if (ifaceTypeShape->shape() != actualTypeShape->shape()) {
if (ifaceTypeShape->Rank() != actualTypeShape->Rank()) {
return false;
} else if (!attrs.test(Attr::Allocatable) && !attrs.test(Attr::Pointer) &&
ifaceTypeShape->shape() != actualTypeShape->shape()) {
return false;
} else {
return ifaceTypeShape->type().IsTkCompatibleWith(