Skip to content

Commit 79c2a1e

Browse files
authored
[flang][runtime] Correct SELECTED_LOGICAL_KIND() (#93108)
The implementation of the runtime version of this intrinsic function in #89691 was incorrect. Fix it to interpret its argument as a bit count.
1 parent 9ce8e63 commit 79c2a1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flang/runtime/numeric.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedIntKind(T x) {
117117
template <typename T>
118118
inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedLogicalKind(
119119
T x) {
120-
if (x <= 2) {
120+
if (x <= 8) {
121121
return 1;
122-
} else if (x <= 4) {
122+
} else if (x <= 16) {
123123
return 2;
124-
} else if (x <= 9) {
124+
} else if (x <= 32) {
125125
return 4;
126-
} else if (x <= 18) {
126+
} else if (x <= 64) {
127127
return 8;
128128
}
129129
return -1;

0 commit comments

Comments
 (0)