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)


Hello,

new patch included.

Tobias Burnus schrieb:
>> I think the dg-error string is interpreted as a regexp, where the ()
>> have special meaning. Try "Internal file .* is incompatible with
>> namelist", I guess it should work.
>>     
As Janis Johnson found out, the ".*" eats too much. This is the reason
why the first case passes and the second one (with the same error
message) fails; as "(1)" is also wrong, one has to use "\\(1\\)". Thanks
to Janis!

New patch below.

Build (I think bootstrapped, but I'm not exactly sure what is meant by
it) and regtested on
x86_64-unknown-linux-gnu.


Side questions:

- How to run only the gfortran test suit? I found check-gcc, but no
check-(g)fortran.

- I get   "XPASS: gfortran.dg/csqrt_2.f (PR24313)."
  Is it time to remove the "{ xfail *-*-linux-gnu }"?
  That it passes I also see when looking at the results of Andreas Jaeger,
  but, well, he also uses an openSUSE system with glibc 3.5.

Tobias

2006-10-27  Tobias Burnus  <burnus@net-b.de>

	PR fortran/28224
	* io.c (check_io_constraints): Allow namelists
          for internal files for Fortran 2003.

2006-10-27  Tobias Burnus  <burnus@net-b.de>

	PR fortran/PR28224
	* gfortran.dg/io_constraints_2.f90: Remove check for
          using namelists with internal files.
	* gfortran.dg/namelist_internal.f90: New namelists test.
	* gfortran.dg/namelist_internal2.f90: New namelists test.

Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c	(Revision 118080)
+++ gcc/fortran/io.c	(Arbeitskopie)
@@ -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: gcc/testsuite/gfortran.dg/io_constraints_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/io_constraints_2.f90	(Revision 118080)
+++ gcc/testsuite/gfortran.dg/io_constraints_2.f90	(Arbeitskopie)
@@ -39,8 +39,6 @@
 !
 ! Not allowed with internal unit
 !Was correctly picked up before patch.
- write(buffer, NML=NL)                          !  { dg-error "incompatible with namelist" }
-!Was correctly picked up before patch.
  write(buffer, fmt='(i6)', REC=10) a            !  { dg-error "REC tag" }
  write(buffer, fmt='(i6)', END=10) a            !  { dg-error "END tag" }
 
--- /dev/null	2006-10-21 23:34:46.000000000 +0200
+++ gcc/testsuite/gfortran.dg/namelist_internal.f90	2006-10-26 01:00:42.000000000 +0200
@@ -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
--- /dev/null	2006-10-21 23:34:46.000000000 +0200
+++ gcc/testsuite/gfortran.dg/namelist_internal2.f90	2006-10-27 00:22:21.000000000 +0200
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-fall-intrinsics -std=f95" }
+! Checks internal file read/write of namelists
+! (Fortran 2003 feature)
+! PR fortran/28224
+program nml_internal
+  implicit none
+  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) ! { dg-error "Internal file at \\(1\\) is incompatible with namelist" }
+  i = -33
+  j = 10
+  r = sin(1.0)
+  read(str,nml=nam) ! { dg-error "Internal file at \\(1\\) is incompatible with namelist" }
+  if(i /= 42 .or. j /= -718 .or. abs(r-exp(1.0)) > 1e-5) call abort()
+end program nml_internal

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