https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125606
--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Harald Anlauf <[email protected]>: https://gcc.gnu.org/g:38bb3d6612ca67697ac46db5b7afccd3773d8bcc commit r15-11277-g38bb3d6612ca67697ac46db5b7afccd3773d8bcc 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. (cherry picked from commit 2dcdb2463f89930b8cdd2b15f962bd3df5dd83f7)
