OSDN Git Service

2005-11-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / namelist_use.f90
1 ! { dg-do run }
2 ! This tests the fix for PR22010, where namelists were not being written to
3 ! and read back from modules.  It has two namelists: one that is USE
4 ! associated and another that is concatenated by USE and host association.
5 !
6 ! Contributed by Paul Thomas  pault@gcc.gnu.org
7 !
8 module global
9   character*4 :: aa
10   integer :: ii
11   real    :: rr
12   namelist /nml1/ aa, ii, rr
13   namelist /nml2/ aa
14 end module global
15 program namelist_use
16   use global
17   real    :: rrr
18   namelist /nml2/ ii, rrr    ! Concatenate use and host associated variables.
19   open (10, status="scratch")
20   write (10,*) "&NML1 aa='lmno' ii=1 rr=2.5 /"
21   write (10,*) "&NML2 aa='pqrs' ii=2 rrr=3.5 /"
22   rewind (10)
23   read (10,nml=nml1,iostat=i)
24   if ((i.ne.0).or.(aa.ne."lmno").or.(ii.ne.1).or.(rr.ne.2.5)) call abort ()
25
26   read (10,nml=nml2,iostat=i) 
27   if ((i.ne.0).or.(aa.ne."pqrs").or.(ii.ne.2).or.(rrr.ne.3.5)) call abort ()
28
29   close (10)
30 end program namelist_use