[flang-commits] [flang] e141e71 - [flang] Fix character length calculation for Unicode component
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon May 23 17:48:21 PDT 2022
Author: Peter Klausler
Date: 2022-05-23T17:48:12-07:00
New Revision: e141e719e166665ac7313eece4cb1c8e82b9ab45
URL: https://github.com/llvm/llvm-project/commit/e141e719e166665ac7313eece4cb1c8e82b9ab45
DIFF: https://github.com/llvm/llvm-project/commit/e141e719e166665ac7313eece4cb1c8e82b9ab45.diff
LOG: [flang] Fix character length calculation for Unicode component
The character length value in the derived type component information table
entry is already in units of characters, not bytes, so don't divide by the
per-character byte size.
Differential Revision: https://reviews.llvm.org/D126139
Added:
Modified:
flang/runtime/type-info.cpp
Removed:
################################################################################
diff --git a/flang/runtime/type-info.cpp b/flang/runtime/type-info.cpp
index 8f66aeab40793..ecc2bf9e28d91 100644
--- a/flang/runtime/type-info.cpp
+++ b/flang/runtime/type-info.cpp
@@ -91,7 +91,7 @@ void Component::EstablishDescriptor(Descriptor &descriptor,
if (cat == TypeCategory::Character) {
std::size_t lengthInChars{0};
if (auto length{characterLen_.GetValue(&container)}) {
- lengthInChars = static_cast<std::size_t>(*length / kind_);
+ lengthInChars = static_cast<std::size_t>(*length);
} else {
RUNTIME_CHECK(
terminator, characterLen_.genre() == Value::Genre::Deferred);
More information about the flang-commits
mailing list