https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108450
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Mikael Morin <mik...@gcc.gnu.org>: https://gcc.gnu.org/g:32502d82a5b54ca5b8e524df9fcad851727dc54a commit r12-9108-g32502d82a5b54ca5b8e524df9fcad851727dc54a Author: Mikael Morin <mik...@gcc.gnu.org> Date: Sun Jan 29 21:57:24 2023 +0100 fortran: Set name for *LOC default BACK argument [PR108450] This change fixes an ICE caused by the double resolution of MINLOC, MAXLOC and FINDLOC expressions which get a default value for the BACK argument at resolution time. That argument is added without name, and argument reordering code is not prepared to handle unnamed arguments coming after named ones, so the second resolution causes a NULL pointer dereference. The problem is fixed by explicitly setting the argument name. PR fortran/108450 gcc/fortran/ChangeLog: * check.cc (gfc_check_minloc_maxloc): Explicitly set argument name. (gfc_check_findloc): Ditto. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/minmaxloc_1.f90: New test. (cherry picked from commit 2e32a12c04c72f692a7bd119fd3e4e5b74392c9d)