Skip to content

Commit d06b55e

Browse files
authored
[Flang][Runtime] Improve runtime implementation of the RENAME intrinsic (#99445)
The RENAME implementation in the Fortran runtime had a few glitches that had to be addressed: - Wrong usage of RTDECL (fixed) - Issue fatal error when trying to use RENAME on a target device (fixed)
1 parent 3717776 commit d06b55e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flang/runtime/misc-intrinsic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ static RT_API_ATTRS void TransferImpl(Descriptor &result,
5656
extern "C" {
5757
RT_EXT_API_GROUP_BEGIN
5858

59-
void RTDECL(Rename)(const Descriptor &path1, const Descriptor &path2,
59+
void RTDEF(Rename)(const Descriptor &path1, const Descriptor &path2,
6060
const Descriptor *status, const char *sourceFile, int line) {
6161
Terminator terminator{sourceFile, line};
62-
62+
#if !defined(RT_DEVICE_COMPILATION)
6363
char *pathSrc{EnsureNullTerminated(
6464
path1.OffsetElement(), path1.ElementBytes(), terminator)};
6565
char *pathDst{EnsureNullTerminated(
@@ -84,6 +84,9 @@ void RTDECL(Rename)(const Descriptor &path1, const Descriptor &path2,
8484
if (pathDst != path2.OffsetElement()) {
8585
FreeMemory(pathDst);
8686
}
87+
#else // !defined(RT_DEVICE_COMPILATION)
88+
terminator.Crash("RENAME intrinsic is only supported on host devices");
89+
#endif // !defined(RT_DEVICE_COMPILATION)
8790
}
8891

8992
void RTDEF(Transfer)(Descriptor &result, const Descriptor &source,

0 commit comments

Comments
 (0)