[flang-commits] [flang] [flang][runtime] Correct SELECTED_LOGICAL_KIND() (PR #93108)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed May 22 16:25:26 PDT 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/93108
The implementation of the runtime version of this intrinsic function in https://github.com/llvm/llvm-project/pull/89691 was incorrect. Fix it to interpret its argument as a bit count.
>From 3e208966e8fb162f2af7ecc7052e0552fb1c3d92 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 22 May 2024 16:23:37 -0700
Subject: [PATCH] [flang][runtime] Correct SELECTED_LOGICAL_KIND()
The implementation of the runtime version of this intrinsic
function in https://github.com/llvm/llvm-project/pull/89691 was
incorrect. Fix it to interpret its argument as a bit count.
---
flang/runtime/numeric.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/flang/runtime/numeric.cpp b/flang/runtime/numeric.cpp
index 52b5a56894d88..2225473c4690e 100644
--- a/flang/runtime/numeric.cpp
+++ b/flang/runtime/numeric.cpp
@@ -117,13 +117,13 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedIntKind(T x) {
template <typename T>
inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedLogicalKind(
T x) {
- if (x <= 2) {
+ if (x <= 8) {
return 1;
- } else if (x <= 4) {
+ } else if (x <= 16) {
return 2;
- } else if (x <= 9) {
+ } else if (x <= 32) {
return 4;
- } else if (x <= 18) {
+ } else if (x <= 64) {
return 8;
}
return -1;
More information about the flang-commits
mailing list