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]

Re: [patch,fortran] Allow namelist with internal file (PR 28224)


Hi,

Paul Thomas wrote:
>>> Might it not be better to use -std=f95 for this test....
I misread "this" as "this test (that follows):" rather than "this test
(shown in the previous line)", which caused my confusion.
Sorry for the confusion I caused by being confused.

Submitted with the suggested change (dg-option -std=f95); I had to
change one dg-error since -std=f95 changed the error message.

(Just for completeness, the patch was first regression tested with "make
check" (I did now an additional "make check-gfortran" after the change)
on x86_64-unknown-linux-gnu = openSUSE 10.2b1 x86_64.)

Tobias

Index: testsuite/gfortran.dg/io_constraints_2.f90
===================================================================
--- testsuite/gfortran.dg/io_constraints_2.f90  (Revision 118112)
+++ testsuite/gfortran.dg/io_constraints_2.f90  (Revision 118113)
@@ -1,4 +1,5 @@
 ! { dg-do compile }
+! { dg-options "-std=f95" }
 ! Part II of the test  of the IO constraints patch, which fixes PRs:
 ! PRs 25053, 25063, 25064, 25066, 25067, 25068, 25069, 25307 and 20862.
 ! Modified2006-07-08 to check the patch for PR20844.
@@ -35,7 +36,7 @@

  write(*, NML=NL) z                             !  { dg-error "followed
by IO-list" }
 !Was correctly picked up before patch.
- print NL, z                                    !  { dg-error "followed
by IO-list" }
+ print NL, z                                    !  { dg-error "PRINT
namelist at \\(1\\) is an extension" }
 !
 ! Not allowed with internal unit
 !Was correctly picked up before patch.
Index: testsuite/gfortran.dg/namelist_internal.f90
===================================================================
--- testsuite/gfortran.dg/namelist_internal.f90 (Revision 0)
+++ testsuite/gfortran.dg/namelist_internal.f90 (Revision 118113)
@@ -0,0 +1,21 @@
+! { dg-do run }
+! { dg-options "-fall-intrinsics -std=f2003" }
+! Checks internal file read/write of namelists
+! (Fortran 2003 feature)
+! PR fortran/28224
+program nml_internal
+  integer   :: i, j
+  real      :: r
+  namelist /nam/ i, j, r
+  character(len=250) :: str
+
+  i = 42
+  j = -718
+  r = exp(1.0)
+  write(str,nml=nam)
+  i = -33
+  j = 10
+  r = sin(1.0)
+  read(str,nml=nam)
+  if(i /= 42 .or. j /= -718 .or. abs(r-exp(1.0)) > 1e-5) call abort()
+end program nml_internal
Index: fortran/io.c
===================================================================
--- fortran/io.c        (Revision 118112)
+++ fortran/io.c        (Revision 118113)
@@ -2596,9 +2596,13 @@
                     "REC tag at %L is incompatible with internal file",
                     &dt->rec->where);

-      io_constraint (dt->namelist != NULL,
-                    "Internal file at %L is incompatible with namelist",
-                    &expr->where);
+      if (dt->namelist != NULL)
+        {
+          if (gfc_notify_std(GFC_STD_F2003,
+                         "Internal file at %L is incompatible with
namelist",
+                         &expr->where) == FAILURE)
+            m = MATCH_ERROR;
+        }

       io_constraint (dt->advance != NULL,
                     "ADVANCE tag at %L is incompatible with internal file",


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