https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93580
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Mark Eggleston <markeggles...@gcc.gnu.org>: https://gcc.gnu.org/g:d4c10c9f4bff616e7ed07e92504fe31a700e2af1 commit r10-6691-gd4c10c9f4bff616e7ed07e92504fe31a700e2af1 Author: Mark Eggleston <markeggles...@gcc.gnu.org> Date: Tue Feb 18 10:00:50 2020 +0000 [fortran] ICE in gfc_validate_kind(): Got bad kind [PR93580] Caused by using invalid part_refs in kind specifications, e.g. %re or %im on non-complex expressions and %len on non character expressions. Check whether %re, %im and %len are valid when checking kind specification. The original patch from Steven G. Kargl <ka...@gcc.gnu.org> only checked for %re and %im. gcc/fortran/ChangeLog: PR fortran/93580 * primary.c (gfc_match_varspec): If the symbol following % is re or im and the primary expression type is not BT_COMPLEX issue an error. If the symbol is len and the primary expression type is not BT_CHARACTER is an error. gcc/testsuite/ChangeLog: PR fortran/93580 * gfortran.dg/dg/pr93580.f90: New test.