Skip to content

Commit b6927bc

Browse files
authored
[flang-rt] Fix more added memcpy that need runtime wrappers (llvm#3240)
2 parents ddd7551 + 7e0e40f commit b6927bc

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

flang-rt/lib/runtime/edit-input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ RT_API_ATTRS bool EditIntegerInput(IoStatementState &io, const DataEdit &edit,
296296
auto shft{static_cast<int>(sizeof value - kind)};
297297
if (!isHostLittleEndian && shft >= 0) {
298298
auto shifted{value << (8 * shft)};
299-
std::memcpy(n, &shifted, kind);
299+
Fortran::runtime::memcpy(n, &shifted, kind);
300300
} else {
301-
std::memcpy(n, &value, kind); // a blank field means zero
301+
Fortran::runtime::memcpy(n, &value, kind); // a blank field means zero
302302
}
303303
#else
304304
auto shft{static_cast<int>(sizeof(value.low())) - kind};

flang-rt/lib/runtime/temporary-stack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void DescriptorStorage<COPY_VALUES>::resize(size_type newCapacity) {
9797
// Avoid passing a null pointer, since it would result in an undefined
9898
// behavior.
9999
if (data_ != nullptr) {
100-
memcpy(newData, data_, capacity_ * sizeof(Descriptor *));
100+
Fortran::runtime::memcpy(newData, data_, capacity_ * sizeof(Descriptor *));
101101
FreeMemory(data_);
102102
}
103103
data_ = newData;

flang-rt/lib/runtime/time-intrinsic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ void RTNAME(Etime)(const Descriptor *values, const Descriptor *time,
525525
ULARGE_INTEGER userSystemTime;
526526
ULARGE_INTEGER kernelSystemTime;
527527

528-
memcpy(&userSystemTime, &userTime, sizeof(FILETIME));
529-
memcpy(&kernelSystemTime, &kernelTime, sizeof(FILETIME));
528+
Fortran::runtime::memcpy(&userSystemTime, &userTime, sizeof(FILETIME));
529+
Fortran::runtime::memcpy(&kernelSystemTime, &kernelTime, sizeof(FILETIME));
530530

531531
usrTime = ((double)(userSystemTime.QuadPart)) / 10000000.0;
532532
sysTime = ((double)(kernelSystemTime.QuadPart)) / 10000000.0;

flang/include/flang/Decimal/binary-floating-point.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "flang/Common/api-attrs.h"
1616
#include "flang/Common/real.h"
1717
#include "flang/Common/uint128.h"
18+
#include "flang/Runtime/freestanding-tools.h"
1819
#include <cinttypes>
1920
#include <climits>
2021
#include <cstring>
@@ -68,7 +69,7 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
6869
template <typename A>
6970
explicit constexpr RT_API_ATTRS BinaryFloatingPointNumber(A x) {
7071
static_assert(sizeof raw_ <= sizeof x);
71-
std::memcpy(reinterpret_cast<void *>(&raw_),
72+
Fortran::runtime::memcpy(reinterpret_cast<void *>(&raw_),
7273
reinterpret_cast<const void *>(&x), sizeof raw_);
7374
}
7475

0 commit comments

Comments
 (0)