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]

Re: [Patch, Fortran] PR49791 - Fix legacy namelist support


Jerry DeLisle wrote:
I would say OK for trunk and then backport in a few weeks. If you feel like being conservative you could use

|| (dtp->u.p.ionml->type == BT_DERIVED && !dtp->u.p.ionml->touched)) but I do not think it is necessary.

I have committed the initial patch as Rev. 176661.


* * *

However, the following test case still fails with the now-patched gfortran version. It worked with gfortran before the October 2010 patch - and it also works with g95, pgi and openf95/pathf95/sunf95/crayftn. The testcase is:

!--------------------------
! { dg-do run }
!
!  PR fortran/49791
!

type t
  integer :: array(4)
end type t

type(t) :: a
namelist /nml/a

a%array = [ 1,2,3,4]
open(999, status='scratch')
write(999,'(a)') '&nml a%array(1) = 99, 192 /'
rewind(999)
read(999, nml=nml)
if (any (a%array /= [ 99, 192, 3, 4])) call abort ()
!write(*,nml=nml)
end
!--------------------------


Using your patch (cf. below) fixes it - but it regresses for gfortran.dg/namelist_66.f90 (PR PR46010):
Fortran runtime error: Cannot match namelist object name 'bb'


That's while reading:

&naml1
    tracer(1)   = 'aa', .true.
    tracer(2)   = 'bb', .true.
    tracer(3)   = 'cc', .true.
 /

Thus, it somehow regards a quoted string - after the namelist object name - as object name! The namelist object is:

type ptracer
   character(len = 2)  :: sname
   logical              :: lini
end type ptracer
type(ptracer) , dimension(3) :: tracer

Tobias

PS: The patch which causes the regression is:

--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2215,3 +2215,4 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
|| !(compile_options.allow_std & GFC_STD_GNU)
- || dtp->u.p.ionml->type == BT_DERIVED)
+ || (dtp->u.p.ionml->type == BT_DERIVED
+ && !dtp->u.p.ionml->touched))
ls[dim].end = ls[dim].start;



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