From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2071) id 8090F3855028; Sun, 18 Jul 2021 19:36:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8090F3855028 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Harald Anlauf To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2386] Fortran: reject FORMAT tag of unknown type. X-Act-Checkin: gcc X-Git-Author: Harald Anlauf X-Git-Refname: refs/heads/master X-Git-Oldrev: 5586e7e85de381f3df843091494889f8ad8e3e1f X-Git-Newrev: f527b8233498b40c8a2c616b82265f2e58aba42a Message-Id: <20210718193624.8090F3855028@sourceware.org> Date: Sun, 18 Jul 2021 19:36:24 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 19:36:24 -0000 https://gcc.gnu.org/g:f527b8233498b40c8a2c616b82265f2e58aba42a commit r12-2386-gf527b8233498b40c8a2c616b82265f2e58aba42a Author: Harald Anlauf Date: Sun Jul 18 21:35:53 2021 +0200 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: --- gcc/fortran/io.c | 2 +- gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 40cd76eb585..fc97df79eca 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 00000000000..3b3c260ef7f --- /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