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.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/flang-rt/lib/runtime/descriptor-io.cpp b/flang-rt/lib/runtime/descriptor-io.cpp
index a60d0b90da46..e00072510aff 100644
--- a/flang-rt/lib/runtime/descriptor-io.cpp
+++ b/flang-rt/lib/runtime/descriptor-io.cpp
@@ -42,7 +42,7 @@ inline RT_API_ATTRS A &ExtractElement(IoStatementState &io,
}
// Defined formatted I/O (maybe)
-static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
+static RT_API_ATTRS common::optional<bool> DefinedFormattedIo(
IoStatementState &io, const Descriptor &descriptor,
const typeInfo::DerivedType &derived,
const typeInfo::SpecialBinding &special,
@@ -50,7 +50,7 @@ static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
// Look at the next data edit descriptor. If this is list-directed I/O, the
// "maxRepeat=0" argument will prevent the input from advancing over an
// initial '(' that shouldn't be consumed now as the start of a real part.
- Fortran::common::optional<DataEdit> peek{io.GetNextDataEdit(/*maxRepeat=*/0)};
+ common::optional<DataEdit> peek{io.GetNextDataEdit(/*maxRepeat=*/0)};
if (peek &&
(peek->descriptor == DataEdit::DefinedDerivedType ||
peek->descriptor == DataEdit::ListDirected ||
@@ -65,7 +65,7 @@ static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
if (edit.descriptor == DataEdit::DefinedDerivedType) {
ioType[0] = 'D';
ioType[1] = 'T';
- std::memcpy(ioType + 2, edit.ioType, edit.ioTypeChars);
+ runtime::memcpy(ioType + 2, edit.ioType, edit.ioTypeChars);
} else {
runtime::strcpy(
ioType, io.mutableModes().inNamelist ? "NAMELIST" : "LISTDIRECTED");
@@ -107,7 +107,7 @@ static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
std::int32_t unit{external->unitNumber()};
std::int32_t ioStat{IostatOk};
char ioMsg[100];
- Fortran::common::optional<std::int64_t> startPos;
+ common::optional<std::int64_t> startPos;
if (edit.descriptor == DataEdit::DefinedDerivedType &&
special.which() == typeInfo::SpecialBinding::Which::ReadFormatted) {
// DT is an edit descriptor, so everything that the child
@@ -170,11 +170,13 @@ static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
io.GotChar(io.InquirePos() - *startPos);
}
return handler.GetIoStat() == IostatOk;
+ } else if (peek && peek->descriptor == DataEdit::ListDirectedNullValue) {
+ return false;
} else {
// There's a defined I/O subroutine, but there's a FORMAT present and
// it does not have a DT data edit descriptor, so apply default formatting
// to the components of the derived type as usual.
- return Fortran::common::nullopt;
+ return common::nullopt;
}
}