[flang-commits] [PATCH] D79349: [flang] Fix to IsDescriptor
Tim Keith via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu May 7 07:55:39 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ccc7e567249: [flang] Fix to IsDescriptor (authored by tskeith).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79349/new/
https://reviews.llvm.org/D79349
Files:
flang/include/flang/Semantics/type.h
flang/lib/Evaluate/type.cpp
flang/lib/Semantics/type.cpp
flang/test/Semantics/offsets01.f90
Index: flang/test/Semantics/offsets01.f90
===================================================================
--- flang/test/Semantics/offsets01.f90
+++ flang/test/Semantics/offsets01.f90
@@ -49,4 +49,6 @@
end type
type(t1(n)) :: x1 !CHECK: x1 size=48 offset=
type(t2(n,n)) :: x2 !CHECK: x2 size=56 offset=
+ !CHECK: a size=48 offset=0:
+ !CHECK: b size=72 offset=0:
end
Index: flang/lib/Semantics/type.cpp
===================================================================
--- flang/lib/Semantics/type.cpp
+++ flang/lib/Semantics/type.cpp
@@ -507,6 +507,13 @@
bool ArraySpec::IsAssumedRank() const {
return Rank() == 1 && front().lbound().isAssumed();
}
+bool ArraySpec::IsConstantShape() const {
+ return CheckAll([](const ShapeSpec &x) {
+ const auto &lb{x.lbound().GetExplicit()};
+ const auto &ub{x.ubound().GetExplicit()};
+ return lb && ub && IsConstantExpr(*lb) && IsConstantExpr(*ub);
+ });
+}
llvm::raw_ostream &operator<<(
llvm::raw_ostream &os, const ArraySpec &arraySpec) {
Index: flang/lib/Evaluate/type.cpp
===================================================================
--- flang/lib/Evaluate/type.cpp
+++ flang/lib/Evaluate/type.cpp
@@ -31,13 +31,8 @@
}
}
}
- if (details.IsAssumedShape() || details.IsDeferredShape() ||
- details.IsAssumedRank()) {
- return true;
- }
- // TODO: Explicit shape component array dependent on length parameter
// TODO: Automatic (adjustable) arrays - are they descriptors?
- return false;
+ return !details.shape().empty() && !details.shape().IsConstantShape();
}
static bool IsDescriptor(const ProcEntityDetails &details) {
Index: flang/include/flang/Semantics/type.h
===================================================================
--- flang/include/flang/Semantics/type.h
+++ flang/include/flang/Semantics/type.h
@@ -223,6 +223,7 @@
bool IsImpliedShape() const;
bool IsAssumedSize() const;
bool IsAssumedRank() const;
+ bool IsConstantShape() const; // explicit shape with constant bounds
private:
// Check non-empty and predicate is true for each element.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79349.262654.patch
Type: text/x-patch
Size: 2105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200507/0df2034b/attachment-0001.bin>
More information about the flang-commits
mailing list