[flang-commits] [PATCH] D105969: [flang] Add default implementation for SYSTEM_CLOCK

Kiran Chandramohan via Phabricator via flang-commits flang-commits at lists.llvm.org
Sat Aug 14 14:46:22 PDT 2021


kiranchandramohan requested changes to this revision.
kiranchandramohan added a comment.
This revision now requires changes to proceed.

Please audit all usage of std::clock_t. std::clock_t can be unsigned on some platforms.  This has led to a couple of failures like the one mentioned inline and https://reviews.llvm.org/D107972.



================
Comment at: flang/runtime/time-intrinsic.cpp:107
+  return std::min(std::numeric_limits<std::clock_t>::max(),
+      std::numeric_limits<count_t>::max());
+}
----------------
In some systems like MacOS, std::clock_t is defined as unsigned long whereas count_t can be long long. This can lead to compilation errors.


```
flang/runtime/time-intrinsic.cpp:106:10: error: no matching function for call to 'min'
  return std::min(std::numeric_limits<std::clock_t>::max(),
         ^~~~~~~~
/Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2560:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'long long')
min(const _Tp& __a, const _Tp& __b)
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105969/new/

https://reviews.llvm.org/D105969



More information about the flang-commits mailing list