Skip to content

Commit 0510b10

Browse files
committed
[flang] Fix merge issue with memcpy and address build warnings
- Fixes unresolved memcpy error seen in: smoke-fort-dev/{flang-464660-2,rocm-issue-201}
1 parent 544233f commit 0510b10

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

flang-rt/include/flang-rt/runtime/descriptor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
#include <cstdio>
3030
#include <cstring>
3131

32+
RT_OFFLOAD_VAR_GROUP_BEGIN
3233
/// Value used for asyncId when no specific stream is specified.
3334
static constexpr std::int64_t kNoAsyncId = -1;
35+
RT_OFFLOAD_VAR_GROUP_END
3436

3537
namespace Fortran::runtime {
3638

flang-rt/lib/runtime/descriptor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "flang-rt/runtime/terminator.h"
1616
#include "flang-rt/runtime/type-info.h"
1717
#include "flang/Common/type-kinds.h"
18+
#include "flang/Runtime/freestanding-tools.h"
1819
#include <cassert>
1920
#include <cstdlib>
2021
#include <cstring>
@@ -26,7 +27,7 @@ RT_OFFLOAD_API_GROUP_BEGIN
2627
RT_API_ATTRS Descriptor::Descriptor(const Descriptor &that) { *this = that; }
2728

2829
RT_API_ATTRS Descriptor &Descriptor::operator=(const Descriptor &that) {
29-
std::memcpy(this, &that, that.SizeInBytes());
30+
Fortran::runtime::memcpy(this, &that, that.SizeInBytes());
3031
return *this;
3132
}
3233

flang-rt/lib/runtime/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ static void ConfigureFloatingPoint() {
2828
}
2929

3030
std::thread::id _main_thread_id = std::this_thread::get_id();
31-
extern "C" {
3231
std::thread::id RTNAME(GetMainThreadId)() { return _main_thread_id; }
3332

33+
extern "C" {
3434
void RTNAME(ProgramStart)(int argc, const char *argv[], const char *envp[],
3535
const EnvironmentDefaultList *envDefaults) {
3636
std::atexit(Fortran::runtime::NotifyOtherImagesOfNormalEnd);

flang/include/flang/Runtime/freestanding-tools.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ using std::memmove;
186186
using MemmoveFct = void *(*)(void *, const void *, std::size_t);
187187

188188
#ifdef RT_DEVICE_COMPILATION
189+
[[maybe_unused]]
189190
static RT_API_ATTRS void *MemmoveWrapper(
190191
void *dest, const void *src, std::size_t count) {
191192
return Fortran::runtime::memmove(dest, src, count);

flang/include/flang/Runtime/main.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
struct EnvironmentDefaultList;
1717

18-
FORTRAN_EXTERN_C_BEGIN
1918
std::thread::id RTNAME(GetMainThreadId)();
19+
20+
FORTRAN_EXTERN_C_BEGIN
2021
void RTNAME(ProgramStart)(
2122
int, const char *[], const char *[], const struct EnvironmentDefaultList *);
2223
void RTNAME(ByteswapOption)(void); // -byteswapio

0 commit comments

Comments
 (0)