public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8811] Fortran: reject FORMAT tag of unknown type.
@ 2021-07-28 18:18 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2021-07-28 18:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0b506dcf9f9c41d94ccb6c2839884d029378ec0a

commit r11-8811-g0b506dcf9f9c41d94ccb6c2839884d029378ec0a
Author: Harald Anlauf <anlauf@gmx.de>
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.
    
    (cherry picked from commit f527b8233498b40c8a2c616b82265f2e58aba42a)

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-28 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 18:18 [gcc r11-8811] Fortran: reject FORMAT tag of unknown type Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).