#endif
#define FORTRAN_RUNTIME_STAT_MISSING_ENV_VAR 1
#define FORTRAN_RUNTIME_STAT_ENV_VARS_UNSUPPORTED 2
+
+#if 0
+Processor-defined status code for MOVE_ALLOC where arguments are the
+same allocatable.
+#endif
+#define FORTRAN_RUNTIME_STAT_MOVE_ALLOC_SAME_ALLOCATABLE 109
+
#endif
// If to and from are the same allocatable they must not be allocated
// and nothing should be done.
if (from.raw().base_addr == to.raw().base_addr && from.IsAllocated()) {
- return ReturnError(terminator, StatInvalidDescriptor, errMsg, hasStat);
+ return ReturnError(
+ terminator, StatMoveAllocSameAllocatable, errMsg, hasStat);
}
if (to.IsAllocated()) {
case StatMissingEnvVariable:
return "Missing environment variable";
+ case StatMoveAllocSameAllocatable:
+ return "MOVE_ALLOC passed the same address as to and from";
+
default:
return nullptr;
}
StatInvalidArgumentNumber = FORTRAN_RUNTIME_STAT_INVALID_ARG_NUMBER,
StatMissingArgument = FORTRAN_RUNTIME_STAT_MISSING_ARG,
StatValueTooShort = FORTRAN_RUNTIME_STAT_VALUE_TOO_SHORT,
+ StatMoveAllocSameAllocatable =
+ FORTRAN_RUNTIME_STAT_MOVE_ALLOC_SAME_ALLOCATABLE,
};
const char *StatErrorString(int);
// move_alloc with the same allocated array should fail
stat = RTNAME(MoveAlloc)(*a, *a, true, errMsg.get(), __FILE__, __LINE__);
- EXPECT_EQ(stat, 18);
+ EXPECT_EQ(stat, 109);
std::string_view errStr{errMsg->OffsetElement(), errMsg->ElementBytes()};
auto trim_pos = errStr.find_last_not_of(' ');
if (trim_pos != errStr.npos)
errStr.remove_suffix(errStr.size() - trim_pos - 1);
- EXPECT_EQ(errStr, "Invalid descriptor");
+ EXPECT_EQ(errStr, "MOVE_ALLOC passed the same address as to and from");
}