mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-22 17:03:32 +00:00
[flang] Allow for deferred-length character in EstablishDescriptor
When the runtime is initializing an instance of a derived type, don't crash if an allocatable character component has deferred length. Differential Revision: https://reviews.llvm.org/D119731
This commit is contained in:
parent
2e0ef179d8
commit
07b9a44515
@ -89,9 +89,14 @@ void Component::EstablishDescriptor(Descriptor &descriptor,
|
||||
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);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
Explicit = 2,
|
||||
LenParameter = 3
|
||||
};
|
||||
|
||||
Genre genre() const { return genre_; }
|
||||
std::optional<TypeParameterValue> GetValue(const Descriptor *) const;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user