blob: a7805b4557a5d7c89435ce1adb0246f0a00dd60a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
! { dg-do run }
module foo_nml
implicit none
real :: x = -1
namelist /foo/ x
end module
!
! Yes, implicit typing of local variable 'x'.
!
program main
use foo_nml, only: bar => foo
integer fd
x = 42
open(newunit=fd, file='tmp.dat', status='replace')
write(fd,nml=bar)
close(fd)
open(newunit=fd, file='tmp.dat', status='old')
read(fd,nml=bar)
close(fd)
call bah
if (x /= 42) stop 1
end program
subroutine bah
use foo_nml
integer fd
open(newunit=fd, file='tmp.dat', status='old')
read(fd,nml=foo)
if (x /= -1) stop 2
close(fd, status='delete')
end subroutine bah
|