OSDN Git Service

2010-04-24 Kai Tietz <kai.tietz@onevision.com>
[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 ! Concatenate use and host associated variables - an extension.
19   namelist /nml2/ ii, rrr    ! { dg-warning "already is USE associated" }
20   open (10, status="scratch")
21   write (10,*) "&NML1 aa='lmno' ii=1 rr=2.5 /"
22   write (10,*) "&NML2 aa='pqrs' ii=2 rrr=3.5 /"
23   rewind (10)
24   read (10,nml=nml1,iostat=i)
25   if ((i.ne.0).or.(aa.ne."lmno").or.(ii.ne.1).or.(rr.ne.2.5)) call abort ()
26
27   read (10,nml=nml2,iostat=i) 
28   if ((i.ne.0).or.(aa.ne."pqrs").or.(ii.ne.2).or.(rrr.ne.3.5)) call abort ()
29
30   close (10)
31 end program namelist_use
32
33 ! { dg-final { cleanup-modules "global" } }