2008-01-06 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 6 Jan 2008 09:21:27 +0000 (09:21 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 6 Jan 2008 09:21:27 +0000 (09:21 +0000)
        PR fortran/34654
        * io.c (check_io_constraints): Disallow unformatted I/O for
        internal units.

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

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131350 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/io.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/internal_io_unf.f90 [new file with mode: 0644]

index 950a0ee..2fccd48 100644 (file)
@@ -1,5 +1,11 @@
 2008-01-06  Tobias Burnus  <burnus@net-b.de>
 
+       PR fortran/34654
+       * io.c (check_io_constraints): Disallow unformatted I/O for
+       internal units.
+
+2008-01-06  Tobias Burnus  <burnus@net-b.de>
+
        PR fortran/34660
        * resolve.c (resolve_formal_arglist): Reject dummy procedure in
        ELEMENTAL functions.
index bb4295b..0bff511 100644 (file)
@@ -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 5036598..b456bba 100644 (file)
@@ -1,5 +1,10 @@
 2008-01-06  Tobias Burnus  <burnus@net-b.de>
 
+       PR fortran/34654
+       * gfortran.dg/internal_io_unf.f90: New.
+
+2008-01-06  Tobias Burnus  <burnus@net-b.de>
+
        PR fortran/34660
        * gfortran.dg/elemental_args_check_2.f90: New.
 
diff --git a/gcc/testsuite/gfortran.dg/internal_io_unf.f90 b/gcc/testsuite/gfortran.dg/internal_io_unf.f90
new file mode 100644 (file)
index 0000000..227b026
--- /dev/null
@@ -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