[flang-commits] [flang] [flang][runtime] Fix total MAXLOC/MINLOC over CHARACTER data (PR #76880)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed Jan 3 16:01:57 PST 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/76880
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.
>From 3bf370d232ae64fcc17e732d2518452822cdc20c Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 3 Jan 2024 15:57:54 -0800
Subject: [PATCH] [flang][runtime] Fix total MAXLOC/MINLOC over CHARACTER data
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.
---
flang/runtime/extrema.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
};
More information about the flang-commits
mailing list