[flang-commits] [PATCH] D106693: [flang] Fix IsSimplyContiguous() for the case of a pointer component

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 23 11:56:05 PDT 2021


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

The result expression for the analysis of a Component is not (longer)
valid in the expression traversal framework used by IsSimplyContiguousHelper
now that it has a tri-state result.  Fix so that any result of
analyzing the component symbol is required to be true, not just
present.


https://reviews.llvm.org/D106693

Files:
  flang/lib/Evaluate/check-expression.cpp


Index: flang/lib/Evaluate/check-expression.cpp
===================================================================
--- flang/lib/Evaluate/check-expression.cpp
+++ flang/lib/Evaluate/check-expression.cpp
@@ -632,7 +632,7 @@
 
   Result operator()(const ArrayRef &x) const {
     const auto &symbol{x.GetLastSymbol()};
-    if (!(*this)(symbol)) {
+    if (!(*this)(symbol).has_value()) {
       return false;
     } else if (auto rank{CheckSubscripts(x.subscript())}) {
       // a(:)%b(1,1) is not contiguous; a(1)%b(:,:) is
@@ -645,7 +645,7 @@
     return CheckSubscripts(x.subscript()).has_value();
   }
   Result operator()(const Component &x) const {
-    return x.base().Rank() == 0 && (*this)(x.GetLastSymbol());
+    return x.base().Rank() == 0 && (*this)(x.GetLastSymbol()).value_or(false);
   }
   Result operator()(const ComplexPart &) const { return false; }
   Result operator()(const Substring &) const { return false; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106693.361288.patch
Type: text/x-patch
Size: 934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210723/951ab996/attachment.bin>


More information about the flang-commits mailing list