Skip to content

Commit

Permalink
[flang] Match the length size in comparison (NFC) (#78302)
Browse files Browse the repository at this point in the history
The template function call CheckDescriptorEqInt((exitStat.get(), 127) is
deduced to have INT_T equal to std::int32_t instead of std::int64_t, but
the length descriptor points to a 64-byte storage. The comparison does
not work in a big endian.

Co-authored-by: Mark Danial <mark.danial@ibm.com>
  • Loading branch information
madanial0 and madanial0 committed Jan 18, 2024
1 parent fe4d502 commit 87ac65a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions flang/unittests/Runtime/CommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ TEST_F(ZeroArguments, ECLValidCommandAndPadSync) {
(*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());

std::string spaces(cmdMsg->ElementBytes(), ' ');
CheckDescriptorEqInt(exitStat.get(), 0);
CheckDescriptorEqInt(cmdStat.get(), 0);
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
CheckDescriptorEqStr(cmdMsg.get(), "No change");
}

Expand All @@ -334,8 +334,8 @@ TEST_F(ZeroArguments, ECLValidCommandStatusSetSync) {
RTNAME(ExecuteCommandLine)
(*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());

CheckDescriptorEqInt(exitStat.get(), 0);
CheckDescriptorEqInt(cmdStat.get(), 0);
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
CheckDescriptorEqStr(cmdMsg.get(), "No change");
}

Expand All @@ -351,9 +351,9 @@ TEST_F(ZeroArguments, ECLInvalidCommandErrorSync) {
#ifdef _WIN32
CheckDescriptorEqInt(exitStat.get(), 1);
#else
CheckDescriptorEqInt(exitStat.get(), 127);
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 127);
#endif
CheckDescriptorEqInt(cmdStat.get(), 3);
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 3);
CheckDescriptorEqStr(cmdMsg.get(), "Invalid command lineXXXX");
}

Expand Down Expand Up @@ -387,7 +387,7 @@ TEST_F(ZeroArguments, ECLValidCommandAndExitStatNoChangeAndCMDStatusSetAsync) {
(*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());

CheckDescriptorEqInt(exitStat.get(), 404);
CheckDescriptorEqInt(cmdStat.get(), 0);
CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
CheckDescriptorEqStr(cmdMsg.get(), "No change");
}

Expand Down

0 comments on commit 87ac65a

Please sign in to comment.