diff options
| author | Mingming Liu <mingmingl@google.com> | 2025-09-10 15:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 15:25:31 -0700 |
| commit | 1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch) | |
| tree | 57f4b1f313c8cf74eed8819870f39c36ea263c68 /flang-rt/lib/runtime/copy.cpp | |
| parent | 898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff) | |
| parent | b8cefcb601ddaa18482555c4ff363c01a270c2fe (diff) | |
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'flang-rt/lib/runtime/copy.cpp')
| -rw-r--r-- | flang-rt/lib/runtime/copy.cpp | 8 |
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())}; |
