diff mbox series

PR fortran/101084 - [10/11/12 Regression] ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1124

Message ID trinity-9b4c6cb0-46c8-4cba-85e2-34d09331031a-1623785468371@3c-app-gmx-bap21
State New
Headers show
Series PR fortran/101084 - [10/11/12 Regression] ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1124 | expand

Commit Message

Harald Anlauf June 15, 2021, 7:31 p.m. UTC
A recent change to the checking of legacy FORMAT tags did not handle
cases where the type is not set.  Adjust the check.

Regtested on x86_64-pc-linux-gnu.

OK for mainline / 11- / 10-branch?

Thanks,
Harald


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.

Comments

Harald Anlauf July 12, 2021, 7:29 p.m. UTC | #1
*Ping*

> Gesendet: Dienstag, 15. Juni 2021 um 21:31 Uhr
> Von: "Harald Anlauf" <anlauf@gmx.de>
> An: "fortran" <fortran@gcc.gnu.org>, "gcc-patches" <gcc-patches@gcc.gnu.org>
> Betreff: [PATCH] PR fortran/101084 - [10/11/12 Regression] ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1124
>
> A recent change to the checking of legacy FORMAT tags did not handle
> cases where the type is not set.  Adjust the check.
>
> Regtested on x86_64-pc-linux-gnu.
>
> OK for mainline / 11- / 10-branch?
>
> Thanks,
> Harald
>
>
> 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 mbox series

Patch

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