[flang-commits] [flang] [flang] Match argument types for std::min (PR #71102)

via flang-commits flang-commits at lists.llvm.org
Thu Nov 2 13:16:15 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: None (kkwli)

<details>
<summary>Changes</summary>

PR #<!-- -->68342 causes build breakage on MacOS due to uint64_t being defined as unsigned long long instead of unsigned long. It leads to type mismatch in the arguments for std::min.

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


1 Files Affected:

- (modified) flang/lib/Evaluate/fold-implementation.h (+3-1) 


``````````diff
diff --git a/flang/lib/Evaluate/fold-implementation.h b/flang/lib/Evaluate/fold-implementation.h
index 868b7b6990fd384..800dc6b75698c86 100644
--- a/flang/lib/Evaluate/fold-implementation.h
+++ b/flang/lib/Evaluate/fold-implementation.h
@@ -910,7 +910,9 @@ template <typename T> Expr<T> Folder<T>::RESHAPE(FunctionRef<T> &&funcRef) {
                 : pad->Reshape(std::move(shape.value()))};
         ConstantSubscripts subscripts{result.lbounds()};
         auto copied{result.CopyFrom(*source,
-            std::min(source->size(), resultElements), subscripts, dimOrderPtr)};
+            std::min(static_cast<decltype(resultElements)>(source->size()),
+                resultElements),
+            subscripts, dimOrderPtr)};
         if (copied < resultElements) {
           CHECK(pad);
           copied += result.CopyFrom(

``````````

</details>


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


More information about the flang-commits mailing list