[flang-commits] [PATCH] D143826: [flang] Respect inaccessibility of type-bound ASSIGNMENT(=)

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Sun Feb 12 09:58:51 PST 2023


klausler updated this revision to Diff 496770.
klausler added a comment.

Fix bug found during integration testing -- it is the accessibility of the generic that matters, of course, not the specific binding.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143826/new/

https://reviews.llvm.org/D143826

Files:
  flang/lib/Semantics/expression.cpp


Index: flang/lib/Semantics/expression.cpp
===================================================================
--- flang/lib/Semantics/expression.cpp
+++ flang/lib/Semantics/expression.cpp
@@ -4035,18 +4035,16 @@
     auto restorer{context_.GetContextualMessages().DiscardMessages()};
     if (const Symbol *symbol{scope.FindSymbol(oprName)}) {
       ExpressionAnalyzer::AdjustActuals noAdjustment;
-      auto pair{context_.ResolveGeneric(*symbol, actuals_, noAdjustment, true)};
-      if (pair.first) {
-        proc = pair.first;
-      } else {
-        context_.EmitGenericResolutionError(*symbol, pair.second, true);
-      }
+      proc =
+          context_.ResolveGeneric(*symbol, actuals_, noAdjustment, true).first;
     }
     for (std::size_t i{0}; !proc && i < actuals_.size(); ++i) {
       const Symbol *generic{nullptr};
       if (const Symbol *binding{FindBoundOp(oprName, i, generic, true)}) {
-        if (const Symbol *resolution{
-                GetBindingResolution(GetType(i), *binding)}) {
+        if (CheckAccessibleSymbol(scope, DEREF(generic))) {
+          // ignore inaccessible type-bound ASSIGNMENT(=) generic
+        } else if (const Symbol *
+            resolution{GetBindingResolution(GetType(i), *binding)}) {
           proc = resolution;
         } else {
           proc = binding;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143826.496770.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230212/10de0d66/attachment.bin>


More information about the flang-commits mailing list