https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:787a8dec1acedf5561c8ee43bed0b3653fca150d commit r16-914-g787a8dec1acedf5561c8ee43bed0b3653fca150d Author: Harald Anlauf <anl...@gmx.de> Date: Tue May 27 19:23:16 2025 +0200 Fortran: fix parsing of type parameter inquiries of substrings [PR101735] Handling of type parameter inquiries of substrings failed to due either parsing issues or not following or handling reference chains properly. PR fortran/101735 gcc/fortran/ChangeLog: * expr.cc (find_inquiry_ref): If an inquiry reference applies to a substring, use that, and calculate substring length if needed. * primary.cc (extend_ref): Also handle attaching to end of reference chain for appending. (gfc_match_varspec): Discrimate between arrays of character and substrings of them. If a substring is taken from a character component of a derived type, get the proper typespec so that inquiry references work correctly. (gfc_match_rvalue): Handle corner case where we hit a seemingly dangling '%' and missed an inquiry reference. Try another match. gcc/testsuite/ChangeLog: * gfortran.dg/inquiry_type_ref_7.f90: New test.