Fortran: force error on bad KIND specifier [PR88552]

gcc/fortran/ChangeLog:

	PR fortran/88552
	* decl.cc (gfc_match_kind_spec): Use error path on missing right
	parenthesis.
	(gfc_match_decl_type_spec): Use error return when an error occurred
	during matching a KIND specifier.

gcc/testsuite/ChangeLog:

	PR fortran/88552
	* gfortran.dg/pr88552.f90: New test.
This commit is contained in:
Harald Anlauf 2023-06-01 23:04:30 +02:00
parent 3bb8ebb6ac
commit ff8f45d20f
2 changed files with 10 additions and 0 deletions

View file

@ -3366,6 +3366,7 @@ close_brackets:
else
gfc_error ("Missing right parenthesis at %C");
m = MATCH_ERROR;
goto no_match;
}
else
/* All tests passed. */
@ -4703,6 +4704,9 @@ get_kind:
}
m = gfc_match_kind_spec (ts, false);
if (m == MATCH_ERROR)
return MATCH_ERROR;
if (m == MATCH_NO && ts->type != BT_CHARACTER)
{
m = gfc_match_old_kind_spec (ts);

View file

@ -0,0 +1,6 @@
! { dg-do compile }
! PR fortran/88552
! Contributed by G.Steinmetz
integer(len((c)) :: n ! { dg-error "must be CHARACTER" }
end