https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114874
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Paul Thomas <pa...@gcc.gnu.org>: https://gcc.gnu.org/g:c887341432bb71cf5540d54955ad7265b0aaca77 commit r14-10216-gc887341432bb71cf5540d54955ad7265b0aaca77 Author: Paul Thomas <pa...@gcc.gnu.org> Date: Fri May 17 15:19:26 2024 +0100 Fortran: Fix select type regression due to r14-9489 [PR114874] 2024-05-17 Paul Thomas <pa...@gcc.gnu.org> gcc/fortran PR fortran/114874 * gfortran.h: Add 'assoc_name_inferred' to gfc_namespace. * match.cc (gfc_match_select_type): Set 'assoc_name_inferred' in select type namespace if the selector has inferred type. * primary.cc (gfc_match_varspec): If a select type temporary is apparently scalar and a left parenthesis has been detected, check the current namespace has 'assoc_name_inferred' set. If so, set inferred_type. * resolve.cc (resolve_variable): If the namespace of a select type temporary is marked with 'assoc_name_inferred' call gfc_fixup_inferred_type_refs to ensure references are OK. (gfc_fixup_inferred_type_refs): Catch invalid array refs.. gcc/testsuite/ PR fortran/114874 * gfortran.dg/pr114874_1.f90: New test for valid code. * gfortran.dg/pr114874_2.f90: New test for invalid code. (cherry picked from commit 5f5074fe7aaf9524defb265299a985eecba7f914)