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