This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR34654 - Disallow unformatted on internal unit


Build and regtested on x86-64.
OK for the trunk?

Tobias
2008-01-05  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34654
	* io.c (check_io_constraints): Disallow unformatted I/O for
	internal units.

2008-01-05  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34654
	* gfortran.dg/internal_io_unf.f90: New.

Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c	(revision 131332)
+++ gcc/fortran/io.c	(working copy)
@@ -2669,6 +2669,11 @@ if (condition) \
 		     "REC tag at %L is incompatible with internal file",
 		     &dt->rec->where);
 
+      io_constraint (dt->format_expr == NULL && dt->format_label == NULL
+		     && dt->namelist == NULL,
+		     "Unformatted I/O not allowed with internal unit at %L",
+		     &dt->io_unit->where);
+
       if (dt->namelist != NULL)
 	{
 	  if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Internal file "
Index: gcc/testsuite/gfortran.dg/internal_io_unf.f90
===================================================================
--- gcc/testsuite/gfortran.dg/internal_io_unf.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/internal_io_unf.f90	(revision 0)
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR fortran/34654
+!
+! Disallow unformatted write to internal unit.
+! Test case was contributed by Joost VandeVondele.
+!
+implicit none
+CHARACTER :: a(3)
+WRITE(a) 0 ! { dg-error "Unformatted I/O not allowed with internal unit" }
+END

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]