forked from OSchip/llvm-project
[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:
parent
6f14dbedd9
commit
948d0b340b
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue