[flang-commits] [PATCH] D125123: [flang] Correct actual/dummy procedure compatibility for ALLOCATABLE/POINTER functions

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri May 6 12:58:37 PDT 2022


klausler created this revision.
klausler added a reviewer: jeanPerier.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

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).


https://reviews.llvm.org/D125123

Files:
  flang/lib/Evaluate/characteristics.cpp


Index: flang/lib/Evaluate/characteristics.cpp
===================================================================
--- flang/lib/Evaluate/characteristics.cpp
+++ flang/lib/Evaluate/characteristics.cpp
@@ -788,7 +788,10 @@
     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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125123.427723.patch
Type: text/x-patch
Size: 792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220506/7ac5e4e8/attachment.bin>


More information about the flang-commits mailing list