https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93580
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Mark Eggleston <markeggles...@gcc.gnu.org>: https://gcc.gnu.org/g:560139481239e37a1cc878fb90805fa5e94f623c commit r9-8251-g560139481239e37a1cc878fb90805fa5e94f623c Author: Mark Eggleston <markeggles...@gcc.gnu.org> Date: Tue Feb 18 10:56:38 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. Backported from mainline 2020-02-18 Mark Eggleston <markeggles...@gcc.gnu.org> 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. PR fortran/93580 * gfortran.dg/dg/pr93580.f90: New test.