https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125606
--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Harald Anlauf <[email protected]>: https://gcc.gnu.org/g:2dcdb2463f89930b8cdd2b15f962bd3df5dd83f7 commit r17-1396-g2dcdb2463f89930b8cdd2b15f962bd3df5dd83f7 Author: Harald Anlauf <[email protected]> Date: Sat Jun 6 21:59:49 2026 +0200 Fortran: fix ICE on LOC intrinsic with polymorphic argument [PR125606] The fix for PR122977 improved the gfc_is_simply_contiguous check for associate variables, but had a side effect when using the LOC() intrinsic on SELECT TYPE temporaries where gfc_is_simply_contiguous could return false. Fall back to simply taking the address of the variable's address. PR fortran/125606 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_loc): When the argument of LOC() is not scalar or known to be simply contiguous, simply take the address of the argument array's first element. gcc/testsuite/ChangeLog: * gfortran.dg/loc_3.f90: New test.
