Can anyone suggest what I am not seeing in regard to the following simple fortran program, which produces a bizarre outcome (I am running openSUSE 11.2 64-bit).
!-------------------------------------------------------------
! junk.f90 18 Jan/2011
program junk
implicit none
integer :: q
open(2,file='junk.par',status='old')
print*,'parameters from junk.par'
open(6,file='./out/junk.out',status='unknown')
!open(7,file='./out/morejunk.out',status='unknown')
read(2,*) q
print*,q
stop
end program junk
!------------------------------------------------------------
Compiled (“gfortran -o junk junk.f90”) and run it produces:
~/flang/urbanLS>./junk
parameters from junk.par
~/flang/urbanLS>
and (this is what is odd) the integer “q” is written into file junk.out.
However if I perturb the program to
!open(6,file='./out/junk.out',status='unknown')
open(7,file='./out/morejunk.out',status='unknown')
and recompile, the result is (the expected behaviour):
~/flang/urbanLS>./junk
parameters from junk.par
1
~/flang/urbanLS>
and there is no write to file morejunk.out. How to explain this!?! Thanks, jdw