Fixed as obvious in revision: 276051. The patch is largely due to Steve, for which thanks.
Paul 2019-09-23 Paul Thomas <pa...@gcc.gnu.org> PR fortran/91729 * match.c (gfc_match_select_rank): Initialise 'as' to NULL. Check for a symtree in the selector expression before trying to assign a value to 'as'. Revert to gfc_error and go to cleanup after setting a MATCH_ERROR. 2019-09-23 Paul Thomas <pa...@gcc.gnu.org> PR fortran/91729 * gfortran.dg/select_rank_2.f90 : Add two more errors in foo2. * gfortran.dg/select_rank_3.f90 : New test. -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein