[flang-commits] [PATCH] D119731: [flang] Allow for deferred-length character in EstablishDescriptor
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Feb 14 10:05:20 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07b9a44515eb: [flang] Allow for deferred-length character in EstablishDescriptor (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119731/new/
https://reviews.llvm.org/D119731
Files:
flang/runtime/type-info.cpp
flang/runtime/type-info.h
Index: flang/runtime/type-info.h
===================================================================
--- flang/runtime/type-info.h
+++ flang/runtime/type-info.h
@@ -38,7 +38,7 @@
Explicit = 2,
LenParameter = 3
};
-
+ Genre genre() const { return genre_; }
std::optional<TypeParameterValue> GetValue(const Descriptor *) const;
private:
Index: flang/runtime/type-info.cpp
===================================================================
--- flang/runtime/type-info.cpp
+++ flang/runtime/type-info.cpp
@@ -89,9 +89,14 @@
const Descriptor &container, Terminator &terminator) const {
TypeCategory cat{category()};
if (cat == TypeCategory::Character) {
- auto length{characterLen_.GetValue(&container)};
- RUNTIME_CHECK(terminator, length.has_value());
- descriptor.Establish(kind_, *length / kind_, nullptr, rank_);
+ std::size_t lengthInChars{0};
+ if (auto length{characterLen_.GetValue(&container)}) {
+ lengthInChars = static_cast<std::size_t>(*length / kind_);
+ } else {
+ RUNTIME_CHECK(
+ terminator, characterLen_.genre() == Value::Genre::Deferred);
+ }
+ descriptor.Establish(kind_, lengthInChars, nullptr, rank_);
} else if (cat == TypeCategory::Derived) {
const DerivedType *type{derivedType()};
RUNTIME_CHECK(terminator, type != nullptr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119731.408480.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220214/45ce2692/attachment.bin>
More information about the flang-commits
mailing list