Skip to content

Commit e1f2791

Browse files
authored
[flang-rt] All flang-rt changes needed for AFAR drop 6.0 (llvm#1326)
2 parents a951580 + 8c5cb40 commit e1f2791

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class Terminator {
6868
template <typename... Args>
6969
RT_API_ATTRS void PrintCrashArgs(const char *message, Args... args) const {
7070
#if defined(RT_DEVICE_COMPILATION)
71-
std::printf(message, args...);
71+
// commenting out temporarily to avoid "error: cannot compile this non-scalar arg in GPU vargs function yet"
72+
// std::printf(message, args...);
7273
#else
7374
std::fprintf(stderr, message, args...);
7475
#endif

flang-rt/lib/runtime/copy.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "copy.h"
1010
#include "stack.h"
1111
#include "flang-rt/runtime/descriptor.h"
12+
#include "flang-rt/runtime/tools.h"
1213
#include "flang-rt/runtime/terminator.h"
1314
#include "flang-rt/runtime/type-info.h"
1415
#include "flang/Runtime/allocatable.h"
@@ -101,7 +102,7 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
101102
char *toPtr{to.Element<char>(toAt)};
102103
char *fromPtr{from.Element<char>(fromAt)};
103104
RUNTIME_CHECK(terminator, to.ElementBytes() == from.ElementBytes());
104-
std::memcpy(toPtr, fromPtr, to.ElementBytes());
105+
Fortran::runtime::memcpy(toPtr, fromPtr, to.ElementBytes());
105106
return;
106107
}
107108

@@ -148,7 +149,7 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
148149
// Moreover, if we came here from an Component::Genre::Data component,
149150
// all the per-element copies are redundant, because the parent
150151
// has already been copied as a whole.
151-
std::memcpy(toPtr, fromPtr, curTo.ElementBytes());
152+
Fortran::runtime::memcpy(toPtr, fromPtr, curTo.ElementBytes());
152153
--elements;
153154
if (elements != 0) {
154155
currentCopy.IncrementSubscripts(terminator);

flang-rt/lib/runtime/io-api-minimal.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "flang/Runtime/io-api.h"
2020

2121
namespace Fortran::runtime::io {
22+
#ifdef RT_OFFLOAD_IO
2223
RT_EXT_API_GROUP_BEGIN
24+
#endif
2325

2426
Cookie IODEF(BeginExternalListOutput)(
2527
ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
@@ -161,4 +163,6 @@ void std::__libcpp_verbose_abort(char const *format, ...) noexcept(
161163
}
162164
#endif
163165

166+
#ifdef RT_OFFLOAD_IO
164167
RT_EXT_API_GROUP_END
168+
#endif

flang-rt/lib/runtime/io-api.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
#include <memory>
3232

3333
namespace Fortran::runtime::io {
34+
#ifdef RT_OFFLOAD_IO
3435
RT_EXT_API_GROUP_BEGIN
36+
#endif
3537

3638
RT_API_ATTRS const char *InquiryKeywordHashDecode(
3739
char *buffer, std::size_t n, InquiryKeywordHash hash) {
@@ -1315,5 +1317,7 @@ enum Iostat IODEF(CheckUnitNumberInRange128)(common::int128_t unit,
13151317
}
13161318
#endif
13171319

1320+
#ifdef RT_OFFLOAD_IO
13181321
RT_EXT_API_GROUP_END
1322+
#endif
13191323
} // namespace Fortran::runtime::io

flang-rt/lib/runtime/terminator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ RT_API_ATTRS void Terminator::CrashHeader() const {
4545
#if defined(RT_DEVICE_COMPILATION)
4646
std::printf("\nfatal Fortran runtime error");
4747
if (sourceFileName_) {
48-
std::printf("(%s", sourceFileName_);
48+
// commenting out temporarily to avoid ICE seen with amd-staging
49+
// std::printf("(%s", sourceFileName_);
4950
if (sourceLine_) {
5051
std::printf(":%d", sourceLine_);
5152
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ using std::fill_n;
110110

111111
#if STD_MEMSET_USE_BUILTIN
112112
static inline RT_API_ATTRS void memset(
113-
void *dest, uint8_t value, std::size_t count) {
113+
void *dest, unsigned char value, std::size_t count) {
114114
__builtin_memset(dest, value, count);
115115
}
116116
#elif STD_MEMSET_UNSUPPORTED
117117
static inline RT_API_ATTRS void memset(
118-
void *dest, uint8_t value, std::size_t count) {
118+
void *dest, unsigned char value, std::size_t count) {
119119
char *to{reinterpret_cast<char *>(dest)};
120120
while (count--) {
121121
*to++ = value;

0 commit comments

Comments
 (0)