[flang-commits] [flang] 87ac65a - [flang] Match the length size in comparison (NFC) (#78302)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 18 07:18:25 PST 2024


Author: madanial0
Date: 2024-01-18T10:18:21-05:00
New Revision: 87ac65a99482ba2563b2b4b0856bf6cb0f7f7fda

URL: https://github.com/llvm/llvm-project/commit/87ac65a99482ba2563b2b4b0856bf6cb0f7f7fda
DIFF: https://github.com/llvm/llvm-project/commit/87ac65a99482ba2563b2b4b0856bf6cb0f7f7fda.diff

LOG: [flang] Match the length size in comparison (NFC) (#78302)

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 at ibm.com>

Added: 
    

Modified: 
    flang/unittests/Runtime/CommandTest.cpp

Removed: 
    


################################################################################
diff  --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index 5ae0f1c72f92c3f..4c3618d0e3d903b 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -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");
 }
 
@@ -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");
 }
 
@@ -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");
 }
 
@@ -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");
 }
 


        


More information about the flang-commits mailing list