[flang-commits] [flang] 4573c31 - [Flang] Fix build failure on MacOS
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu Aug 12 10:15:03 PDT 2021
Author: Kiran Chandramohan
Date: 2021-08-12T18:14:46+01:00
New Revision: 4573c31f8945071d0069dcad31e17ddfeb7a2d8c
URL: https://github.com/llvm/llvm-project/commit/4573c31f8945071d0069dcad31e17ddfeb7a2d8c
DIFF: https://github.com/llvm/llvm-project/commit/4573c31f8945071d0069dcad31e17ddfeb7a2d8c.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
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 flang-commits
mailing list