[flang-commits] [flang] [flang][runtime] Fix total MAXLOC/MINLOC over CHARACTER data (PR #76880)
via flang-commits
flang-commits at lists.llvm.org
Wed Jan 3 16:02:27 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-runtime
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
The implementation of MAXLOC/MINLOC without DIM=1 is wrong for CHARACTER data -- change it to use the character comparator rather than the numeric comparator.
Fixes llvm-test-suite/Fortran/gfortran/regression/maxloc_string_1.f90.
---
Full diff: https://github.com/llvm/llvm-project/pull/76880.diff
1 Files Affected:
- (modified) flang/runtime/extrema.cpp (+1-1)
``````````diff
diff --git a/flang/runtime/extrema.cpp b/flang/runtime/extrema.cpp
index edb5d5f47a5acf..281d8c95466ec4 100644
--- a/flang/runtime/extrema.cpp
+++ b/flang/runtime/extrema.cpp
@@ -135,7 +135,7 @@ template <bool IS_MAX> struct CharacterMaxOrMinLocHelper {
RT_API_ATTRS void operator()(const char *intrinsic, Descriptor &result,
const Descriptor &x, int kind, const char *source, int line,
const Descriptor *mask, bool back) const {
- DoMaxOrMinLoc<TypeCategory::Character, KIND, IS_MAX, NumericCompare>(
+ DoMaxOrMinLoc<TypeCategory::Character, KIND, IS_MAX, CharacterCompare>(
intrinsic, result, x, kind, source, line, mask, back);
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/76880
More information about the flang-commits
mailing list