OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [namelist_use_only.f90] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! This tests the fix for PR22010, where namelists were not being written to
3
! and read back from modules.  It checks that namelists from modules that are
4
! selected by an ONLY declaration work correctly, even when the variables in
5
! the namelist are not host associated. Note that renaming a namelist by USE
6
! association is not allowed by the standard and this is trapped in module.c.
7
!
8
! Contributed by Paul Thomas  pault@gcc.gnu.org
9
!
10
module global
11
  character*4 :: aa, aaa
12
  integer :: ii, iii
13
  real    :: rr, rrr
14
  namelist /nml1/ aa, ii, rr
15
  namelist /nml2/ aaa, iii, rrr
16
contains
17
  logical function foo()
18
    foo = (aaa.ne."pqrs").or.(iii.ne.2).or.(rrr.ne.3.5)
19
  end function foo
20
end module global
21
program namelist_use_only
22
  use global, only : nml1, aa, ii, rr
23
  use global, only : nml2, rrrr=>rrr, foo
24
  open (10, status="scratch")
25
  write (10,'(a)') "&NML1 aa='lmno' ii=1 rr=2.5 /"
26
  write (10,'(a)') "&NML2 aaa='pqrs' iii=2 rrr=3.5 /"
27
  rewind (10)
28
  read (10,nml=nml1,iostat=i)
29
  if ((i.ne.0).or.(aa.ne."lmno").or.(ii.ne.1).or.(rr.ne.2.5)) call abort ()
30
 
31
  read (10,nml=nml2,iostat=i)
32
  if ((i.ne.0).or.(rrrr.ne.3.5).or.foo()) call abort ()
33
  close (10)
34
end program namelist_use_only
35
 
36
! { dg-final { cleanup-modules "global" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.