This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] PR49791 - Fix legacy namelist support


This patch partially undoes the change done in PR 46010.

For that patch, first (comment 7)

+ || !dtp->u.p.ionml->touched)

was added - and after not solving the problem, the complete change was (comment 9 and committed version)

+		      || !dtp->u.p.ionml->touched
+		      || dtp->u.p.ionml->type == BT_DERIVED)



As the current PR 49791 shows, the "touched" line causes the test case to fail. Well, my simple solution was to remove the "touch" line and keep only the BT_DERIVED line.

I have not the slightest idea what the "touch" does (while it is clear to me why the BT_DERIVED helped with the old PR 46010). Thus, I don't know whether there are any side effects. At least there are none which the test suite covers.

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

To which branch versions do we want to backport? The patch for PR 46010 was applied end of last year and affects the branches 4.4, 4.5 and 4.6. As it is a regression, I am inclined to apply it to all versions starting from 4.4.

If the patch makes sense, I think it should be have a relatively low regression risk: It is close to the before October 2010 version but it continues to fix PR 49791. Thus, there should be no problem for backporting in this regard.

Tobias
2011-07-21  Tobias Burnus  <burnus@net-b.de>

	PR fortran/49791
	* io/list_read.c (nml_parse_qualifier): Remove check to
	enabled extended read for another case.

2011-07-21  Tobias Burnus  <burnus@net-b.de>

	PR fortran/49791
	* gfortran.dg/namelist_72.f: New.

diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index c88f232..01272d0 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2213,7 +2213,6 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
 		      do not allow excess data to be processed.  */
 		  if (is_array_section == 1
 		      || !(compile_options.allow_std & GFC_STD_GNU)
-		      || !dtp->u.p.ionml->touched
 		      || dtp->u.p.ionml->type == BT_DERIVED)
 		    ls[dim].end = ls[dim].start;
 		  else
--- /dev/null	2011-07-19 07:59:35.374731880 +0200
+++ gcc/gcc/testsuite/gfortran.dg/namelist_72.f	2011-07-21 00:10:23.000000000 +0200
@@ -0,0 +1,33 @@
+! { dg-do run }
+!
+! PR fortran/49791
+!
+! Contributed by Elliott Sales de Andrade
+!
+      program namelist_test
+
+      dimension xpos(5000), ypos(5000)
+      namelist /geometry/ xpos, ypos
+
+      xpos = -huge(xpos)
+      ypos = -huge(ypos)
+
+      open(unit=4,file='geometry.in')
+      write(4,'(a)') '$geometry'
+      write(4,'(a)') ' xpos(1)= 0.00, 0.10, 0.20, 0.30, 0.40,'
+      write(4,'(a)') ' ypos(1)= 0.50, 0.60, 0.70, 0.80, 0.90,'
+      write(4,'(a)') '$end'
+
+      close(4)
+
+      open (unit=4,file='geometry.in',status='old',form='formatted')
+      read (4,geometry)
+      close(4, status='delete')
+
+      !print *, 'xpos', xpos(1:10), 'ypos', ypos(1:10)
+
+      if (any (xpos(1:5) /= [0.00, 0.10, 0.20, 0.30, 0.40]))call abort()
+      if (any (ypos(1:5) /= [0.50, 0.60, 0.70, 0.80, 0.90]))call abort()
+      if (any (xpos(6:) /= -huge(xpos))) call abort ()
+      if (any (ypos(6:) /= -huge(ypos))) call abort ()
+      end

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