[flang-commits] [flang] 0a7d2b5 - [flang][msvc] Fix compilation of external-hello-world test with MSVC.

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Wed Apr 21 13:19:00 PDT 2021


Author: Mehdi Chinoune
Date: 2021-04-21T15:18:24-05:00
New Revision: 0a7d2b5f50a1e3e900ade773021879ff13399653

URL: https://github.com/llvm/llvm-project/commit/0a7d2b5f50a1e3e900ade773021879ff13399653
DIFF: https://github.com/llvm/llvm-project/commit/0a7d2b5f50a1e3e900ade773021879ff13399653.diff

LOG: [flang][msvc] Fix compilation of external-hello-world test with MSVC.

MSVC doesn't accept division by zero.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D96069

Added: 
    

Modified: 
    flang/unittests/Runtime/external-hello.cpp

Removed: 
    


################################################################################
diff  --git a/flang/unittests/Runtime/external-hello.cpp b/flang/unittests/Runtime/external-hello.cpp
index eba345481db91..a9394082805c9 100644
--- a/flang/unittests/Runtime/external-hello.cpp
+++ b/flang/unittests/Runtime/external-hello.cpp
@@ -2,6 +2,7 @@
 #include "../../runtime/main.h"
 #include "../../runtime/stop.h"
 #include <cstring>
+#include <limits>
 
 using namespace Fortran::runtime::io;
 
@@ -13,9 +14,9 @@ void output1() {
   IONAME(OutputReal64)(io, 0.0);
   IONAME(OutputReal64)(io, 2.0 / 3.0);
   IONAME(OutputReal64)(io, 1.0e99);
-  IONAME(OutputReal64)(io, 1.0 / 0.0);
-  IONAME(OutputReal64)(io, -1.0 / 0.0);
-  IONAME(OutputReal64)(io, 0.0 / 0.0);
+  IONAME(OutputReal64)(io, std::numeric_limits<double>::infinity());
+  IONAME(OutputReal64)(io, -std::numeric_limits<double>::infinity());
+  IONAME(OutputReal64)(io, std::numeric_limits<double>::quiet_NaN());
   IONAME(OutputComplex64)(io, 123.0, -234.0);
   IONAME(OutputLogical)(io, false);
   IONAME(OutputLogical)(io, true);


        


More information about the flang-commits mailing list