Skip to content

Commit 3d6c685

Browse files
authored
[flang][runtime] Fix total MAXLOC/MINLOC over CHARACTER data (#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.
1 parent e06b5a2 commit 3d6c685

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang/runtime/extrema.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ template <bool IS_MAX> struct CharacterMaxOrMinLocHelper {
135135
RT_API_ATTRS void operator()(const char *intrinsic, Descriptor &result,
136136
const Descriptor &x, int kind, const char *source, int line,
137137
const Descriptor *mask, bool back) const {
138-
DoMaxOrMinLoc<TypeCategory::Character, KIND, IS_MAX, NumericCompare>(
138+
DoMaxOrMinLoc<TypeCategory::Character, KIND, IS_MAX, CharacterCompare>(
139139
intrinsic, result, x, kind, source, line, mask, back);
140140
}
141141
};

0 commit comments

Comments
 (0)