From: Harald Anlauf Date: Sun, 18 Jul 2021 19:35:53 +0000 (+0200) Subject: Fortran: reject FORMAT tag of unknown type. X-Git-Tag: basepoints/gcc-13~5927 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f527b8233498b40c8a2c616b82265f2e58aba42a;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 40cd76eb5858..fc97df79ecab 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -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); diff --git a/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 b/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 new file mode 100644 index 000000000000..3b3c260ef7fc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 @@ -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