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

peter klausler via flang-commits flang-commits at lists.llvm.org
Mon Aug 2 09:43:52 PDT 2021


Author: peter klausler
Date: 2021-08-02T09:43:43-07:00
New Revision: bab86463df0789c39888285494bf68c713f0c5f3

URL: https://github.com/llvm/llvm-project/commit/bab86463df0789c39888285494bf68c713f0c5f3
DIFF: https://github.com/llvm/llvm-project/commit/bab86463df0789c39888285494bf68c713f0c5f3.diff

LOG: [flang] Fix IsSimplyContiguous() for the case of a pointer component

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.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index 4f634cb63903b..af7adf54204a2 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -632,7 +632,7 @@ class IsSimplyContiguousHelper
 
   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 @@ class IsSimplyContiguousHelper
     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; }


        


More information about the flang-commits mailing list