Skip to content

Commit e141e71

Browse files
committed
[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
1 parent 74f9841 commit e141e71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang/runtime/type-info.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void Component::EstablishDescriptor(Descriptor &descriptor,
9191
if (cat == TypeCategory::Character) {
9292
std::size_t lengthInChars{0};
9393
if (auto length{characterLen_.GetValue(&container)}) {
94-
lengthInChars = static_cast<std::size_t>(*length / kind_);
94+
lengthInChars = static_cast<std::size_t>(*length);
9595
} else {
9696
RUNTIME_CHECK(
9797
terminator, characterLen_.genre() == Value::Genre::Deferred);

0 commit comments

Comments
 (0)