[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:15:41 PDT 2023
https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/71102
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.
>From a14c79224e4806286a505acb2d5bd14e69e30306 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Thu, 2 Nov 2023 15:06:43 -0400
Subject: [PATCH] [flang] Match argument types for std::min
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.
---
flang/lib/Evaluate/fold-implementation.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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(
More information about the flang-commits
mailing list