summaryrefslogtreecommitdiff
path: root/flang-rt/lib/runtime/descriptor-io.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang-rt/lib/runtime/descriptor-io.cpp')
-rw-r--r--flang-rt/lib/runtime/descriptor-io.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/flang-rt/lib/runtime/descriptor-io.cpp b/flang-rt/lib/runtime/descriptor-io.cpp
index 42ac4c051663..e599e624fe02 100644
--- a/flang-rt/lib/runtime/descriptor-io.cpp
+++ b/flang-rt/lib/runtime/descriptor-io.cpp
@@ -64,10 +64,11 @@ static RT_API_ATTRS common::optional<bool> DefinedFormattedIo(
: *io.GetNextDataEdit(1)};
char ioType[2 + edit.maxIoTypeChars];
auto ioTypeLen{std::size_t{2} /*"DT"*/ + edit.ioTypeChars};
+ auto &definedIoArgs{*io.get_if<DefinedIoArgs>()};
if (edit.descriptor == DataEdit::DefinedDerivedType) {
ioType[0] = 'D';
ioType[1] = 'T';
- runtime::memcpy(ioType + 2, edit.ioType, edit.ioTypeChars);
+ runtime::memcpy(ioType + 2, definedIoArgs.ioType, edit.ioTypeChars);
} else {
runtime::strcpy(
ioType, io.mutableModes().inNamelist ? "NAMELIST" : "LISTDIRECTED");
@@ -81,7 +82,7 @@ static RT_API_ATTRS common::optional<bool> DefinedFormattedIo(
if (integer8) {
// Convert v_list values to INTEGER(8)
for (int j{0}; j < edit.vListEntries; ++j) {
- vList64[j] = edit.vList[j];
+ vList64[j] = definedIoArgs.vList[j];
}
vListDesc.Establish(
TypeCategory::Integer, sizeof(std::int64_t), nullptr, 1);
@@ -91,7 +92,7 @@ static RT_API_ATTRS common::optional<bool> DefinedFormattedIo(
static_cast<SubscriptValue>(sizeof(std::int64_t)));
} else {
vListDesc.Establish(TypeCategory::Integer, sizeof(int), nullptr, 1);
- vListDesc.set_base_addr(edit.vList);
+ vListDesc.set_base_addr(definedIoArgs.vList);
vListDesc.GetDimension(0).SetBounds(1, edit.vListEntries);
vListDesc.GetDimension(0).SetByteStride(
static_cast<SubscriptValue>(sizeof(int)));