[flang-commits] [flang] 287c93c - [flang] Fix unit test failure on POWER

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu Apr 1 16:20:15 PDT 2021


Author: peter klausler
Date: 2021-04-01T16:20:07-07:00
New Revision: 287c93c1321b4342608f28e1a2816300780502e1

URL: https://github.com/llvm/llvm-project/commit/287c93c1321b4342608f28e1a2816300780502e1
DIFF: https://github.com/llvm/llvm-project/commit/287c93c1321b4342608f28e1a2816300780502e1.diff

LOG: [flang] Fix unit test failure on POWER

A new unit test for the Fortran runtime needs to allow for some
architectural variation on Infinity and NaN edge cases of NINT().

Added: 
    

Modified: 
    flang/unittests/RuntimeGTest/Numeric.cpp

Removed: 
    


################################################################################
diff  --git a/flang/unittests/RuntimeGTest/Numeric.cpp b/flang/unittests/RuntimeGTest/Numeric.cpp
index 60a878dbd280..b8d8a993f8bf 100644
--- a/flang/unittests/RuntimeGTest/Numeric.cpp
+++ b/flang/unittests/RuntimeGTest/Numeric.cpp
@@ -118,10 +118,12 @@ TEST(Numeric, Nint) {
   EXPECT_EQ(RTNAME(Nint4_4)(Real<4>{2.5}), 3);
   EXPECT_EQ(RTNAME(Nint8_4)(Real<8>{-2.5}), -3);
   EXPECT_EQ(RTNAME(Nint8_8)(Real<8>{0}), 0);
-  EXPECT_EQ(RTNAME(Nint4_4)(std::numeric_limits<Real<4>>::infinity()),
-      std::numeric_limits<Int<4>>::min());
-  EXPECT_EQ(RTNAME(Nint4_4)(std::numeric_limits<Real<4>>::quiet_NaN()),
-      std::numeric_limits<Int<4>>::min());
+  auto nintInf{RTNAME(Nint4_4)(std::numeric_limits<Real<4>>::infinity())};
+  EXPECT_TRUE(nintInf == std::numeric_limits<Int<4>>::min() ||
+      nintInf == std::numeric_limits<Int<4>>::max());
+  auto nintNaN{RTNAME(Nint4_4)(std::numeric_limits<Real<4>>::quiet_NaN())};
+  EXPECT_TRUE(nintNaN == std::numeric_limits<Int<4>>::min() ||
+      nintNaN == std::numeric_limits<Int<4>>::max());
 }
 
 TEST(Numeric, RRSpacing) {


        


More information about the flang-commits mailing list