Fortran: reject FORMAT tag of unknown type.

gcc/fortran/ChangeLog:

	PR fortran/101084
	* io.c (resolve_tag_format): Extend FORMAT check to unknown type.

gcc/testsuite/ChangeLog:

	PR fortran/101084
	* gfortran.dg/fmt_nonchar_3.f90: New test.

(cherry picked from commit f527b82334)
This commit is contained in:
Harald Anlauf
2021-07-18 21:35:53 +02:00
parent 9d9cebd920
commit 7277ac60e0
2 changed files with 8 additions and 1 deletions

View File

@@ -1763,7 +1763,7 @@ resolve_tag_format (gfc_expr *e)
if (e->ts.type != BT_CHARACTER)
{
if (e->ts.type == BT_DERIVED || e->ts.type == BT_CLASS
|| e->ts.type == BT_VOID)
|| e->ts.type == BT_VOID || e->ts.type == BT_UNKNOWN)
{
gfc_error ("Non-character non-Hollerith in FORMAT tag at %L",
&e->where);

View File

@@ -0,0 +1,7 @@
! { dg-do compile }
! PR fortran/101084
program p
integer, parameter :: a(0) = 1
print int(a) ! { dg-error "Non-character non-Hollerith in FORMAT tag" }
end