Skip to content

Commit

Permalink
[flang][runtime] Fix total MAXLOC/MINLOC over CHARACTER data (#76880)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
klausler committed Jan 15, 2024
1 parent e06b5a2 commit 3d6c685
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flang/runtime/extrema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 3d6c685

Please sign in to comment.