https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120191
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:c12443e824cf96311db7a1be82b3626909c8ceeb commit r14-11770-gc12443e824cf96311db7a1be82b3626909c8ceeb Author: Jakub Jelinek <ja...@redhat.com> Date: Tue May 13 14:14:55 2025 +0200 fortran: Fix up minloc/maxloc lowering [PR120191] We need to drop the kind argument from what is passed to the library, but need to do it not only when one uses the argument name for it (so kind=4 etc.) but also when one passes all the arguments to the intrinsics. The following patch uses what gfc_conv_intrinsic_findloc uses, which looks more efficient and cleaner, we already set automatic vars to point to the kind and back actual arguments, so we can just free/clear expr on the former and set name to "%VAL" on the latter. And similarly clears dim argument for the BT_CHARACTER case when using maxloc2/minloc2, again regardless of whether it was named or not. 2025-05-13 Jakub Jelinek <ja...@redhat.com> Daniil Kochergin <daniil24...@gmail.com> Tobias Burnus <tbur...@baylibre.com> PR fortran/120191 * trans-intrinsic.cc (strip_kind_from_actual): Remove. (gfc_conv_intrinsic_minmaxloc): Don't call strip_kind_from_actual. Free and clear kind_arg->expr if non-NULL. Set back_arg->name to "%VAL" instead of a loop looking for last argument. Remove actual variable, use array_arg instead. Free and clear dim_arg->expr if non-NULL for BT_CHARACTER cases instead of using a loop. * gfortran.dg/pr120191_1.f90: New test. (cherry picked from commit ec249be3c287c6f1dfb328712ac9c39e6fa95eca)