[flang-commits] [flang] [flang] Fix build on Darwin after #92571 (PR #94327)

via flang-commits flang-commits at lists.llvm.org
Tue Jun 4 01:58:35 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Leandro Lupori (luporl)

<details>
<summary>Changes</summary>

flang/runtime/time-intrinsic.cpp:403:19: error: comparison of
integers of different signs: 'clock_t' (aka 'unsigned long') and
'int' [-Werror,-Wsign-compare]
  if (times(&tms) != -1) {


---
Full diff: https://github.com/llvm/llvm-project/pull/94327.diff


1 Files Affected:

- (modified) flang/runtime/time-intrinsic.cpp (+1-1) 


``````````diff
diff --git a/flang/runtime/time-intrinsic.cpp b/flang/runtime/time-intrinsic.cpp
index 989d4f804c5f7..a141fe63764a7 100644
--- a/flang/runtime/time-intrinsic.cpp
+++ b/flang/runtime/time-intrinsic.cpp
@@ -400,7 +400,7 @@ void RTNAME(Etime)(const Descriptor *values, const Descriptor *time,
   }
 #else
   struct tms tms;
-  if (times(&tms) != -1) {
+  if (times(&tms) != (clock_t)-1) {
     usrTime = ((double)(tms.tms_utime)) / sysconf(_SC_CLK_TCK);
     sysTime = ((double)(tms.tms_stime)) / sysconf(_SC_CLK_TCK);
     realTime = usrTime + sysTime;

``````````

</details>


https://github.com/llvm/llvm-project/pull/94327


More information about the flang-commits mailing list