summaryrefslogtreecommitdiff
path: root/flang-rt/lib/runtime/copy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang-rt/lib/runtime/copy.cpp')
-rw-r--r--flang-rt/lib/runtime/copy.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/flang-rt/lib/runtime/copy.cpp b/flang-rt/lib/runtime/copy.cpp
index f990f46e0be6..8b7db61b014e 100644
--- a/flang-rt/lib/runtime/copy.cpp
+++ b/flang-rt/lib/runtime/copy.cpp
@@ -12,6 +12,8 @@
#include "flang-rt/runtime/terminator.h"
#include "flang-rt/runtime/type-info.h"
#include "flang/Runtime/allocatable.h"
+#include "flang/Runtime/freestanding-tools.h"
+
#include <cstring>
namespace Fortran::runtime {
@@ -101,7 +103,7 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
char *toPtr{to.Element<char>(toAt)};
char *fromPtr{from.Element<char>(fromAt)};
RUNTIME_CHECK(terminator, to.ElementBytes() == from.ElementBytes());
- std::memcpy(toPtr, fromPtr, to.ElementBytes());
+ runtime::memcpy(toPtr, fromPtr, to.ElementBytes());
return;
}
@@ -148,7 +150,7 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
// Moreover, if we came here from an Component::Genre::Data component,
// all the per-element copies are redundant, because the parent
// has already been copied as a whole.
- std::memcpy(toPtr, fromPtr, curTo.ElementBytes());
+ runtime::memcpy(toPtr, fromPtr, curTo.ElementBytes());
--elements;
if (elements != 0) {
currentCopy.IncrementSubscripts(terminator);
@@ -166,6 +168,8 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
std::size_t nComponents{componentDesc.Elements()};
for (std::size_t j{0}; j < nComponents; ++j, ++component) {
if (component->genre() == typeInfo::Component::Genre::Allocatable ||
+ component->genre() ==
+ typeInfo::Component::Genre::AllocatableDevice ||
component->genre() == typeInfo::Component::Genre::Automatic) {
Descriptor &toDesc{
*reinterpret_cast<Descriptor *>(toPtr + component->offset())};