[flang] Take into account SubprogramDetails in GetInterfaceSymbol
authorJean Perier <jperier@nvidia.com>
Thu, 30 Sep 2021 21:06:22 +0000 (23:06 +0200)
committerJean Perier <jperier@nvidia.com>
Thu, 30 Sep 2021 21:06:32 +0000 (23:06 +0200)
When the ProcRef is Symbol is a SubprogramDetails, the interface is
the SubprogramDetails. Do not return nullptr.

Differential Revision: https://reviews.llvm.org/D110853

flang/lib/Evaluate/call.cpp

index 395751a..18d51a2 100644 (file)
@@ -123,6 +123,8 @@ const Symbol *ProcedureDesignator::GetInterfaceSymbol() const {
     } else if (const auto *binding{
                    ultimate.detailsIf<semantics::ProcBindingDetails>()}) {
       return &binding->symbol();
+    } else if (ultimate.has<semantics::SubprogramDetails>()) {
+      return &ultimate;
     }
   }
   return nullptr;