aboutsummaryrefslogtreecommitdiff
path: root/flang-rt/lib
diff options
context:
space:
mode:
Diffstat (limited to 'flang-rt/lib')
-rw-r--r--flang-rt/lib/runtime/assign.cpp12
-rw-r--r--flang-rt/lib/runtime/descriptor-io.cpp26
-rw-r--r--flang-rt/lib/runtime/descriptor.cpp21
-rw-r--r--flang-rt/lib/runtime/edit-input.cpp126
-rw-r--r--flang-rt/lib/runtime/io-stmt.cpp51
-rw-r--r--flang-rt/lib/runtime/namelist.cpp3
-rw-r--r--flang-rt/lib/runtime/pointer.cpp19
-rw-r--r--flang-rt/lib/runtime/unit.h3
8 files changed, 150 insertions, 111 deletions
diff --git a/flang-rt/lib/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp
index d642ed5..7cf4147 100644
--- a/flang-rt/lib/runtime/assign.cpp
+++ b/flang-rt/lib/runtime/assign.cpp
@@ -279,13 +279,15 @@ RT_API_ATTRS int AssignTicket::Begin(WorkQueue &workQueue) {
if (mustDeallocateLHS) {
// Convert the LHS into a temporary, then make it look deallocated.
toDeallocate_ = &tempDescriptor_.descriptor();
- persist_ = true; // tempDescriptor_ state must outlive child tickets
std::memcpy(
reinterpret_cast<void *>(toDeallocate_), &to_, to_.SizeInBytes());
to_.set_base_addr(nullptr);
if (toDerived_ && (flags_ & NeedFinalization)) {
- if (int status{workQueue.BeginFinalize(*toDeallocate_, *toDerived_)};
- status != StatOk && status != StatContinue) {
+ int status{workQueue.BeginFinalize(*toDeallocate_, *toDerived_)};
+ if (status == StatContinue) {
+ // tempDescriptor_ state must outlive pending child ticket
+ persist_ = true;
+ } else if (status != StatOk) {
return status;
}
flags_ &= ~NeedFinalization;
@@ -304,6 +306,9 @@ RT_API_ATTRS int AssignTicket::Begin(WorkQueue &workQueue) {
if (int stat{ReturnError(
workQueue.terminator(), newFrom.Allocate(kNoAsyncObject))};
stat != StatOk) {
+ if (stat == StatContinue) {
+ persist_ = true;
+ }
return stat;
}
if (HasDynamicComponent(*from_)) {
@@ -507,6 +512,7 @@ RT_API_ATTRS int AssignTicket::Continue(WorkQueue &workQueue) {
}
}
if (persist_) {
+ // tempDescriptor_ must outlive pending child ticket(s)
done_ = true;
return StatContinue;
} else {
diff --git a/flang-rt/lib/runtime/descriptor-io.cpp b/flang-rt/lib/runtime/descriptor-io.cpp
index 3868c8d..e22fc79 100644
--- a/flang-rt/lib/runtime/descriptor-io.cpp
+++ b/flang-rt/lib/runtime/descriptor-io.cpp
@@ -47,15 +47,19 @@ static RT_API_ATTRS Fortran::common::optional<bool> DefinedFormattedIo(
const typeInfo::DerivedType &derived,
const typeInfo::SpecialBinding &special,
const SubscriptValue subscripts[]) {
- Fortran::common::optional<DataEdit> peek{
- io.GetNextDataEdit(0 /*to peek at it*/)};
+ // 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)};
if (peek &&
(peek->descriptor == DataEdit::DefinedDerivedType ||
- peek->descriptor == DataEdit::ListDirected)) {
+ peek->descriptor == DataEdit::ListDirected ||
+ peek->descriptor == DataEdit::ListDirectedRealPart)) {
// Defined formatting
IoErrorHandler &handler{io.GetIoErrorHandler()};
- DataEdit edit{*io.GetNextDataEdit(1)}; // now consume it; no repeats
- RUNTIME_CHECK(handler, edit.descriptor == peek->descriptor);
+ DataEdit edit{peek->descriptor == DataEdit::ListDirectedRealPart
+ ? *peek
+ : *io.GetNextDataEdit(1)};
char ioType[2 + edit.maxIoTypeChars];
auto ioTypeLen{std::size_t{2} /*"DT"*/ + edit.ioTypeChars};
if (edit.descriptor == DataEdit::DefinedDerivedType) {
@@ -836,13 +840,23 @@ template RT_API_ATTRS int DescriptorIoTicket<Direction::Input>::Continue(
template <Direction DIR>
RT_API_ATTRS bool DescriptorIO(IoStatementState &io,
- const Descriptor &descriptor, const NonTbpDefinedIoTable *table) {
+ const Descriptor &descriptor, const NonTbpDefinedIoTable *originalTable) {
bool anyIoTookPlace{false};
+ const NonTbpDefinedIoTable *defaultTable{io.nonTbpDefinedIoTable()};
+ const NonTbpDefinedIoTable *table{originalTable};
+ if (!table) {
+ table = defaultTable;
+ } else if (table != defaultTable) {
+ io.set_nonTbpDefinedIoTable(table); // for nested I/O
+ }
WorkQueue workQueue{io.GetIoErrorHandler()};
if (workQueue.BeginDescriptorIo<DIR>(io, descriptor, table, anyIoTookPlace) ==
StatContinue) {
workQueue.Run();
}
+ if (defaultTable != table) {
+ io.set_nonTbpDefinedIoTable(defaultTable);
+ }
return anyIoTookPlace;
}
diff --git a/flang-rt/lib/runtime/descriptor.cpp b/flang-rt/lib/runtime/descriptor.cpp
index b723acd..021440c 100644
--- a/flang-rt/lib/runtime/descriptor.cpp
+++ b/flang-rt/lib/runtime/descriptor.cpp
@@ -85,7 +85,7 @@ RT_API_ATTRS void Descriptor::Establish(int characterKind,
RT_API_ATTRS void Descriptor::Establish(const typeInfo::DerivedType &dt,
void *p, int rank, const SubscriptValue *extent,
ISO::CFI_attribute_t attribute) {
- std::size_t elementBytes{dt.sizeInBytes()};
+ auto elementBytes{static_cast<std::size_t>(dt.sizeInBytes())};
ISO::EstablishDescriptor(
&raw_, p, attribute, CFI_type_struct, elementBytes, rank, extent);
if (elementBytes == 0) {
@@ -252,18 +252,21 @@ RT_API_ATTRS bool Descriptor::EstablishPointerSection(const Descriptor &source,
return CFI_section(&raw_, &source.raw_, lower, upper, stride) == CFI_SUCCESS;
}
-RT_API_ATTRS void Descriptor::ApplyMold(const Descriptor &mold, int rank) {
- raw_.elem_len = mold.raw_.elem_len;
+RT_API_ATTRS void Descriptor::ApplyMold(
+ const Descriptor &mold, int rank, bool isMonomorphic) {
raw_.rank = rank;
- raw_.type = mold.raw_.type;
for (int j{0}; j < rank && j < mold.raw_.rank; ++j) {
GetDimension(j) = mold.GetDimension(j);
}
- if (auto *addendum{Addendum()}) {
- if (auto *moldAddendum{mold.Addendum()}) {
- *addendum = *moldAddendum;
- } else {
- INTERNAL_CHECK(!addendum->derivedType());
+ if (!isMonomorphic) {
+ raw_.elem_len = mold.raw_.elem_len;
+ raw_.type = mold.raw_.type;
+ if (auto *addendum{Addendum()}) {
+ if (auto *moldAddendum{mold.Addendum()}) {
+ *addendum = *moldAddendum;
+ } else {
+ INTERNAL_CHECK(!addendum->derivedType());
+ }
}
}
}
diff --git a/flang-rt/lib/runtime/edit-input.cpp b/flang-rt/lib/runtime/edit-input.cpp
index 0cc287a..3a8abf3 100644
--- a/flang-rt/lib/runtime/edit-input.cpp
+++ b/flang-rt/lib/runtime/edit-input.cpp
@@ -19,24 +19,21 @@
namespace Fortran::runtime::io {
RT_OFFLOAD_API_GROUP_BEGIN
-// Checks that a list-directed input value has been entirely consumed and
-// doesn't contain unparsed characters before the next value separator.
static inline RT_API_ATTRS bool IsCharValueSeparator(
const DataEdit &edit, char32_t ch) {
- char32_t comma{
- edit.modes.editingFlags & decimalComma ? char32_t{';'} : char32_t{','}};
- return ch == ' ' || ch == '\t' || ch == comma || ch == '/' ||
+ return ch == ' ' || ch == '\t' || ch == '/' ||
+ ch == edit.modes.GetSeparatorChar() ||
(edit.IsNamelist() && (ch == '&' || ch == '$'));
}
+// Checks that a list-directed input value has been entirely consumed and
+// doesn't contain unparsed characters before the next value separator.
static RT_API_ATTRS bool CheckCompleteListDirectedField(
IoStatementState &io, const DataEdit &edit) {
if (edit.IsListDirected()) {
std::size_t byteCount;
if (auto ch{io.GetCurrentChar(byteCount)}) {
- if (IsCharValueSeparator(edit, *ch)) {
- return true;
- } else {
+ if (!IsCharValueSeparator(edit, *ch)) {
const auto &connection{io.GetConnectionState()};
io.GetIoErrorHandler().SignalError(IostatBadListDirectedInputSeparator,
"invalid character (0x%x) after list-directed input value, "
@@ -46,16 +43,9 @@ static RT_API_ATTRS bool CheckCompleteListDirectedField(
static_cast<int>(connection.currentRecordNumber));
return false;
}
- } else {
- return true; // end of record: ok
}
- } else {
- return true;
}
-}
-
-static inline RT_API_ATTRS char32_t GetSeparatorChar(const DataEdit &edit) {
- return edit.modes.editingFlags & decimalComma ? char32_t{';'} : char32_t{','};
+ return true;
}
template <int LOG2_BASE>
@@ -74,7 +64,7 @@ static RT_API_ATTRS bool EditBOZInput(
// Count significant digits after any leading white space & zeroes
int digits{0};
int significantBits{0};
- const char32_t comma{GetSeparatorChar(edit)};
+ char32_t comma{edit.modes.GetSeparatorChar()};
for (; next; next = io.NextInField(remaining, edit)) {
char32_t ch{*next};
if (ch == ' ' || ch == '\t') {
@@ -162,10 +152,6 @@ static RT_API_ATTRS bool EditBOZInput(
return CheckCompleteListDirectedField(io, edit);
}
-static inline RT_API_ATTRS char32_t GetRadixPointChar(const DataEdit &edit) {
- return edit.modes.editingFlags & decimalComma ? char32_t{','} : char32_t{'.'};
-}
-
// Prepares input from a field, and returns the sign, if any, else '\0'.
static RT_API_ATTRS char ScanNumericPrefix(IoStatementState &io,
const DataEdit &edit, Fortran::common::optional<char32_t> &next,
@@ -227,7 +213,7 @@ RT_API_ATTRS bool EditIntegerInput(IoStatementState &io, const DataEdit &edit,
common::uint128_t value{0};
bool any{!!sign};
bool overflow{false};
- const char32_t comma{GetSeparatorChar(edit)};
+ char32_t comma{edit.modes.GetSeparatorChar()};
static constexpr auto maxu128{~common::uint128_t{0}};
for (; next; next = io.NextInField(remaining, edit, &fastField)) {
char32_t ch{*next};
@@ -244,7 +230,7 @@ RT_API_ATTRS bool EditIntegerInput(IoStatementState &io, const DataEdit &edit,
} else if (ch == comma) {
break; // end non-list-directed field early
} else {
- if (edit.modes.inNamelist && ch == GetRadixPointChar(edit)) {
+ if (edit.modes.inNamelist && ch == edit.modes.GetRadixPointChar()) {
// Ignore any fractional part that might appear in NAMELIST integer
// input, like a few other Fortran compilers do.
// TODO: also process exponents? Some compilers do, but they obviously
@@ -350,8 +336,8 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
}
bool bzMode{(edit.modes.editingFlags & blankZero) != 0};
int exponent{0};
- if (!next || (!bzMode && *next == ' ') ||
- (!(edit.modes.editingFlags & decimalComma) && *next == ',')) {
+ char32_t comma{edit.modes.GetSeparatorChar()};
+ if (!next || (!bzMode && *next == ' ') || *next == comma) {
if (!edit.IsListDirected() && !io.GetConnectionState().IsAtEOF()) {
// An empty/blank field means zero when not list-directed.
// A fixed-width field containing only a sign is also zero;
@@ -361,7 +347,7 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
}
return {got, exponent, false};
}
- char32_t radixPointChar{GetRadixPointChar(edit)};
+ char32_t radixPointChar{edit.modes.GetRadixPointChar()};
char32_t first{*next >= 'a' && *next <= 'z' ? *next + 'A' - 'a' : *next};
bool isHexadecimal{false};
if (first == 'N' || first == 'I') {
@@ -376,21 +362,37 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
Put(*next);
}
}
- if (next && *next == '(') { // NaN(...)
- Put('(');
- int depth{1};
- while (true) {
- next = io.NextInField(remaining, edit);
- if (depth == 0) {
- break;
- } else if (!next) {
- return {}; // error
- } else if (*next == '(') {
- ++depth;
- } else if (*next == ')') {
- --depth;
+ if (first == 'N' && (!next || *next == '(') &&
+ remaining.value_or(1) > 0) { // NaN(...)?
+ std::size_t byteCount{0};
+ if (!next) { // NextInField won't return '(' for list-directed
+ next = io.GetCurrentChar(byteCount);
+ }
+ if (next && *next == '(') {
+ int depth{1};
+ while (true) {
+ if (*next >= 'a' && *next <= 'z') {
+ *next = *next - 'a' + 'A';
+ }
+ Put(*next);
+ io.HandleRelativePosition(byteCount);
+ io.GotChar(byteCount);
+ if (remaining) {
+ *remaining -= byteCount;
+ }
+ if (depth == 0) {
+ break; // done
+ }
+ next = io.GetCurrentChar(byteCount);
+ if (!next || remaining.value_or(1) < 1) {
+ return {}; // error
+ } else if (*next == '(') {
+ ++depth;
+ } else if (*next == ')') {
+ --depth;
+ }
}
- Put(*next);
+ next = io.NextInField(remaining, edit);
}
}
} else if (first == radixPointChar || (first >= '0' && first <= '9') ||
@@ -508,7 +510,7 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
} else if (radixPointOffset) {
exponent += *radixPointOffset;
} else {
- // When no redix point (or comma) appears in the value, the 'd'
+ // When no radix point (or comma) appears in the value, the 'd'
// part of the edit descriptor must be interpreted as the number of
// digits in the value to be interpreted as being to the *right* of
// the assumed radix point (13.7.2.3.2)
@@ -518,13 +520,15 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
// Consume the trailing ')' of a list-directed or NAMELIST complex
// input value.
if (edit.descriptor == DataEdit::ListDirectedImaginaryPart) {
- if (next && (*next == ' ' || *next == '\t')) {
+ if (!next || *next == ' ' || *next == '\t') {
io.SkipSpaces(remaining);
next = io.NextInField(remaining, edit);
}
- if (!next) { // NextInField fails on separators like ')'
+ if (!next || *next == ')') { // NextInField fails on separators like ')'
std::size_t byteCount{0};
- next = io.GetCurrentChar(byteCount);
+ if (!next) {
+ next = io.GetCurrentChar(byteCount);
+ }
if (next && *next == ')') {
io.HandleRelativePosition(byteCount);
}
@@ -533,7 +537,7 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
while (next && (*next == ' ' || *next == '\t')) {
next = io.NextInField(remaining, edit);
}
- if (next && (*next != ',' || (edit.modes.editingFlags & decimalComma))) {
+ if (next && *next != comma) {
return {}; // error: unused nonblank character in fixed-width field
}
}
@@ -947,10 +951,12 @@ RT_API_ATTRS bool EditLogicalInput(
"Bad character '%lc' in LOGICAL input field", *next);
return false;
}
- if (remaining) { // ignore the rest of a fixed-width field
- io.HandleRelativePosition(*remaining);
- } else if (edit.descriptor == DataEdit::ListDirected) {
- while (io.NextInField(remaining, edit)) { // discard rest of field
+ if (remaining || edit.descriptor == DataEdit::ListDirected) {
+ // Ignore the rest of the input field; stop after separator when
+ // not list-directed.
+ char32_t comma{edit.modes.GetSeparatorChar()};
+ while (next && *next != comma) {
+ next = io.NextInField(remaining, edit);
}
}
return CheckCompleteListDirectedField(io, edit);
@@ -1006,27 +1012,7 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
// Undelimited list-directed character input: stop at a value separator
// or the end of the current record.
while (auto ch{io.GetCurrentChar(byteCount)}) {
- bool isSep{false};
- switch (*ch) {
- case ' ':
- case '\t':
- case '/':
- isSep = true;
- break;
- case '&':
- case '$':
- isSep = edit.IsNamelist();
- break;
- case ',':
- isSep = !(edit.modes.editingFlags & decimalComma);
- break;
- case ';':
- isSep = !!(edit.modes.editingFlags & decimalComma);
- break;
- default:
- break;
- }
- if (isSep) {
+ if (IsCharValueSeparator(edit, *ch)) {
break;
}
if (length > 0) {
diff --git a/flang-rt/lib/runtime/io-stmt.cpp b/flang-rt/lib/runtime/io-stmt.cpp
index 8056c8d..36bffd4 100644
--- a/flang-rt/lib/runtime/io-stmt.cpp
+++ b/flang-rt/lib/runtime/io-stmt.cpp
@@ -526,6 +526,17 @@ Fortran::common::optional<DataEdit> IoStatementState::GetNextDataEdit(int n) {
[&](auto &x) { return x.get().GetNextDataEdit(*this, n); }, u_);
}
+const NonTbpDefinedIoTable *IoStatementState::nonTbpDefinedIoTable() const {
+ return common::visit(
+ [&](auto &x) { return x.get().nonTbpDefinedIoTable(); }, u_);
+}
+
+void IoStatementState::set_nonTbpDefinedIoTable(
+ const NonTbpDefinedIoTable *table) {
+ common::visit(
+ [&](auto &x) { return x.get().set_nonTbpDefinedIoTable(table); }, u_);
+}
+
bool IoStatementState::Emit(
const char *data, std::size_t bytes, std::size_t elementBytes) {
return common::visit(
@@ -633,10 +644,10 @@ IoStatementState::FastAsciiField IoStatementState::GetUpcomingFastAsciiField() {
if (!connection.isUTF8 && connection.internalIoCharKind <= 1) {
const char *p{nullptr};
if (std::size_t bytes{GetNextInputBytes(p)}) {
- return FastAsciiField(connection, p, bytes);
+ return FastAsciiField{connection, p, bytes};
}
}
- return FastAsciiField(connection);
+ return FastAsciiField{connection};
}
Fortran::common::optional<char32_t> IoStatementState::NextInField(
@@ -828,10 +839,7 @@ ListDirectedStatementState<Direction::Input>::GetNextDataEdit(
edit.descriptor = DataEdit::ListDirectedNullValue;
return edit;
}
- char32_t comma{','};
- if (edit.modes.editingFlags & decimalComma) {
- comma = ';';
- }
+ const char32_t comma{edit.modes.GetSeparatorChar()};
std::size_t byteCount{0};
if (remaining_ > 0 && !realPart_) { // "r*c" repetition in progress
RUNTIME_CHECK(io.GetIoErrorHandler(), repeatPosition_.has_value());
@@ -920,9 +928,12 @@ ListDirectedStatementState<Direction::Input>::GetNextDataEdit(
fastField.connection().positionInRecord = start;
}
}
- if (!imaginaryPart_ && ch && *ch == '(') {
- realPart_ = true;
- fastField.connection().HandleRelativePosition(byteCount);
+ if (!imaginaryPart_ && edit.descriptor == DataEdit::ListDirected && ch &&
+ *ch == '(') {
+ if (maxRepeat > 0) { // not being peeked at fram DefinedFormattedIo()
+ realPart_ = true;
+ fastField.connection().HandleRelativePosition(byteCount);
+ }
edit.descriptor = DataEdit::ListDirectedRealPart;
}
return edit;
@@ -952,12 +963,24 @@ bool ExternalUnformattedIoStatementState<DIR>::Receive(
template <Direction DIR>
ChildIoStatementState<DIR>::ChildIoStatementState(
ChildIo &child, const char *sourceFile, int sourceLine)
- : IoStatementBase{sourceFile, sourceLine}, child_{child} {}
+ : IoStatementBase{sourceFile, sourceLine}, child_{child},
+ mutableModes_{child.parent().mutableModes()} {}
template <Direction DIR>
-MutableModes &ChildIoStatementState<DIR>::mutableModes() {
+const NonTbpDefinedIoTable *
+ChildIoStatementState<DIR>::nonTbpDefinedIoTable() const {
#if !defined(RT_DEVICE_AVOID_RECURSION)
- return child_.parent().mutableModes();
+ return child_.parent().nonTbpDefinedIoTable();
+#else
+ ReportUnsupportedChildIo();
+#endif
+}
+
+template <Direction DIR>
+void ChildIoStatementState<DIR>::set_nonTbpDefinedIoTable(
+ const NonTbpDefinedIoTable *table) {
+#if !defined(RT_DEVICE_AVOID_RECURSION)
+ child_.parent().set_nonTbpDefinedIoTable(table);
#else
ReportUnsupportedChildIo();
#endif
@@ -1030,9 +1053,7 @@ ChildFormattedIoStatementState<DIR, CHAR>::ChildFormattedIoStatementState(
ChildIo &child, const CHAR *format, std::size_t formatLength,
const Descriptor *formatDescriptor, const char *sourceFile, int sourceLine)
: ChildIoStatementState<DIR>{child, sourceFile, sourceLine},
- mutableModes_{child.parent().mutableModes()}, format_{*this, format,
- formatLength,
- formatDescriptor} {}
+ format_{*this, format, formatLength, formatDescriptor} {}
template <Direction DIR, typename CHAR>
void ChildFormattedIoStatementState<DIR, CHAR>::CompleteOperation() {
diff --git a/flang-rt/lib/runtime/namelist.cpp b/flang-rt/lib/runtime/namelist.cpp
index 1bef387..2325ca1 100644
--- a/flang-rt/lib/runtime/namelist.cpp
+++ b/flang-rt/lib/runtime/namelist.cpp
@@ -27,8 +27,7 @@ RT_VAR_GROUP_END
RT_OFFLOAD_API_GROUP_BEGIN
static inline RT_API_ATTRS char32_t GetComma(IoStatementState &io) {
- return io.mutableModes().editingFlags & decimalComma ? char32_t{';'}
- : char32_t{','};
+ return io.mutableModes().GetSeparatorChar();
}
bool IODEF(OutputNamelist)(Cookie cookie, const NamelistGroup &group) {
diff --git a/flang-rt/lib/runtime/pointer.cpp b/flang-rt/lib/runtime/pointer.cpp
index 04487ab..68db259 100644
--- a/flang-rt/lib/runtime/pointer.cpp
+++ b/flang-rt/lib/runtime/pointer.cpp
@@ -87,9 +87,9 @@ void RTDEF(PointerAssociateLowerBounds)(Descriptor &pointer,
}
}
-void RTDEF(PointerAssociateRemapping)(Descriptor &pointer,
+static void RT_API_ATTRS PointerRemapping(Descriptor &pointer,
const Descriptor &target, const Descriptor &bounds, const char *sourceFile,
- int sourceLine) {
+ int sourceLine, bool isMonomorphic) {
Terminator terminator{sourceFile, sourceLine};
SubscriptValue byteStride{/*captured from first dimension*/};
std::size_t boundElementBytes{bounds.ElementBytes()};
@@ -99,7 +99,7 @@ void RTDEF(PointerAssociateRemapping)(Descriptor &pointer,
// the ranks may mismatch. Use target as a mold for initializing
// the pointer descriptor.
INTERNAL_CHECK(static_cast<std::size_t>(pointer.rank()) == boundsRank);
- pointer.ApplyMold(target, boundsRank);
+ pointer.ApplyMold(target, boundsRank, isMonomorphic);
pointer.set_base_addr(target.raw().base_addr);
pointer.raw().attribute = CFI_attribute_pointer;
for (unsigned j{0}; j < boundsRank; ++j) {
@@ -124,6 +124,19 @@ void RTDEF(PointerAssociateRemapping)(Descriptor &pointer,
}
}
+void RTDEF(PointerAssociateRemapping)(Descriptor &pointer,
+ const Descriptor &target, const Descriptor &bounds, const char *sourceFile,
+ int sourceLine) {
+ PointerRemapping(
+ pointer, target, bounds, sourceFile, sourceLine, /*isMonomorphic=*/false);
+}
+void RTDEF(PointerAssociateRemappingMonomorphic)(Descriptor &pointer,
+ const Descriptor &target, const Descriptor &bounds, const char *sourceFile,
+ int sourceLine) {
+ PointerRemapping(
+ pointer, target, bounds, sourceFile, sourceLine, /*isMonomorphic=*/true);
+}
+
RT_API_ATTRS void *AllocateValidatedPointerPayload(
std::size_t byteSize, int allocatorIdx) {
// Add space for a footer to validate during deallocation.
diff --git a/flang-rt/lib/runtime/unit.h b/flang-rt/lib/runtime/unit.h
index 9aec9b1..f266a48 100644
--- a/flang-rt/lib/runtime/unit.h
+++ b/flang-rt/lib/runtime/unit.h
@@ -161,9 +161,6 @@ public:
lock_.Take();
#endif
A &state{u_.emplace<A>(std::forward<X>(xs)...)};
- if constexpr (!std::is_same_v<A, OpenStatementState>) {
- state.mutableModes() = ConnectionState::modes;
- }
directAccessRecWasSet_ = false;
io_.emplace(state);
return *io_;