[llvm-branch-commits] [flang] 0c25e01 - [Flang] Fix build failure on MacOS

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 17 20:22:32 PDT 2021


Author: Kiran Chandramohan
Date: 2021-08-17T20:22:13-07:00
New Revision: 0c25e0174861548ade7cd34671067adbcc0ce5a9

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

LOG: [Flang] Fix build failure on MacOS

std::clock_t can be an unsigned value on some platforms like MacOS and
therefore needs a cast when initializing an std::clock_t value with -1.

Reviewed By: klausler

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

(cherry picked from commit 4573c31f8945071d0069dcad31e17ddfeb7a2d8c)

Added: 
    

Modified: 
    flang/runtime/time-intrinsic.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/time-intrinsic.cpp b/flang/runtime/time-intrinsic.cpp
index 5e7c1bc484d55..d6b1c36bf9e00 100644
--- a/flang/runtime/time-intrinsic.cpp
+++ b/flang/runtime/time-intrinsic.cpp
@@ -36,7 +36,7 @@ using preferred_implementation = int;
 // This is the fallback implementation, which should work everywhere.
 template <typename Unused = void> double GetCpuTime(fallback_implementation) {
   std::clock_t timestamp{std::clock()};
-  if (timestamp != std::clock_t{-1}) {
+  if (timestamp != static_cast<std::clock_t>(-1)) {
     return static_cast<double>(timestamp) / CLOCKS_PER_SEC;
   }
 


        


More information about the llvm-branch-commits mailing list