[flang-commits] [flang] [flang] Match argument types for std::min (PR #71102)
via flang-commits
flang-commits at lists.llvm.org
Mon Nov 6 07:36:18 PST 2023
https://github.com/kkwli updated https://github.com/llvm/llvm-project/pull/71102
>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 1/2] [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(
>From 391e9c7acf532d76e9e670c4dc9bbe08bcb4cb91 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Mon, 6 Nov 2023 10:35:30 -0500
Subject: [PATCH 2/2] [flang] change to use explicit type instead of decltype
---
flang/lib/Evaluate/fold-implementation.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/flang/lib/Evaluate/fold-implementation.h b/flang/lib/Evaluate/fold-implementation.h
index 800dc6b75698c86..a1bde778e5ec07e 100644
--- a/flang/lib/Evaluate/fold-implementation.h
+++ b/flang/lib/Evaluate/fold-implementation.h
@@ -910,8 +910,7 @@ 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(static_cast<decltype(resultElements)>(source->size()),
- resultElements),
+ std::min(static_cast<uint64_t>(source->size()), resultElements),
subscripts, dimOrderPtr)};
if (copied < resultElements) {
CHECK(pad);
More information about the flang-commits
mailing list