]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/34654 (no unformatted on internal file)
authorTobias Burnus <burnus@net-b.de>
Sun, 6 Jan 2008 09:21:27 +0000 (10:21 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Sun, 6 Jan 2008 09:21:27 +0000 (10:21 +0100)
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/34654
        * gfortran.dg/internal_io_unf.f90: New.

From-SVN: r131350

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

index 950a0ee4564e6ec35008884a24133b456897505b..2fccd4862f80ca05ce2f84fbf8143aae27be7222 100644 (file)
@@ -1,3 +1,9 @@
+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
index bb4295b866af1942def0501142b696c0edf3699a..0bff511db065f3923590942f497fbc3b701e0ad0 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 5036598e1407c18b4ba87e3919158488d50da644..b456bba426aaa14aecbee28c88e4f0288563ff21 100644 (file)
@@ -1,3 +1,8 @@
+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
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