Skip to content

Commit

Permalink
[Flang] Fix build failure on MacOS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kiranchandramohan committed Aug 12, 2021
1 parent e25665f commit 4573c31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flang/runtime/time-intrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 4573c31

Please sign in to comment.