re PR fortran/42901 (reading array of structures from namelist fails)
2010-02-04 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/42901 *gfortran.dg/namelist_60.f90: New test. *gfortran.dg/namelist_59.f90: New test. From-SVN: r156508
This commit is contained in:
parent
19c6b16e93
commit
2a081e8b47
|
@ -1,3 +1,9 @@
|
|||
2010-02-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR libfortran/42901
|
||||
*gfortran.dg/namelist_60.f90: New test.
|
||||
*gfortran.dg/namelist_59.f90: New test.
|
||||
|
||||
2010-02-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR rtl-optimization/42952
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
! { dg-do run }
|
||||
! PR41192 NAMELIST input with just a comment ("&NAME ! comment \") error
|
||||
program cmdline
|
||||
! comment by itself causes error in gfortran
|
||||
call process(' ')
|
||||
call process('i=10 , j=20 k=30 ! change all three values')
|
||||
call process(' ')
|
||||
call process('! change no values')! before patch this failed.
|
||||
end program cmdline
|
||||
|
||||
subroutine process(string)
|
||||
implicit none
|
||||
character(len=*) :: string
|
||||
character(len=132) :: lines(3)
|
||||
character(len=255) :: message
|
||||
integer :: i=1,j=2,k=3
|
||||
integer ios
|
||||
namelist /cmd/ i,j,k
|
||||
save cmd
|
||||
lines(1)='&cmd'
|
||||
lines(2)=string
|
||||
lines(3)='/'
|
||||
|
||||
read(lines,nml=cmd,iostat=ios,iomsg=message)
|
||||
if (ios.ne.0) call abort
|
||||
end subroutine process
|
|
@ -0,0 +1,27 @@
|
|||
! { dg-do run }
|
||||
! PR42901 Reading array of structures from namelist
|
||||
! Test case derived from the reporters test case.
|
||||
program test_nml
|
||||
type field_descr
|
||||
integer number
|
||||
end type
|
||||
type fsetup
|
||||
type (field_descr), dimension(3) :: vel ! 3 velocity components
|
||||
end type
|
||||
type (fsetup) field_setup
|
||||
namelist /nl_setup/ field_setup
|
||||
field_setup%vel%number = 0
|
||||
! write(*,nml=nl_setup)
|
||||
open(10, status="scratch")
|
||||
write(10,'(a)') "&nl_setup"
|
||||
write(10,'(a)') " field_setup%vel(1)%number= 3,"
|
||||
write(10,'(a)') " field_setup%vel(2)%number= 9,"
|
||||
write(10,'(a)') " field_setup%vel(3)%number= 27,"
|
||||
write(10,'(a)') "/"
|
||||
rewind(10)
|
||||
read(10,nml=nl_setup)
|
||||
if (field_setup%vel(1)%number .ne. 3) call abort
|
||||
if (field_setup%vel(2)%number .ne. 9) call abort
|
||||
if (field_setup%vel(3)%number .ne. 27) call abort
|
||||
! write(*,nml=nl_setup)
|
||||
end program test_nml
|
Loading…
Reference in New Issue