Re: Scope question (gfortran odd-man out)



awgreynolds@xxxxxxxxxxxxx wrote:
Finally, here's the code that gfortran has problems with:

program main
call something
end

subroutine something
! integer i !correct results from gfortran depend on this statement
character lit*1,line*100
lit(i)=line(i:i)
i=1; n=5; line='PZ0R1'
if (internal(4)) stop
write(*,*) i
contains
logical function internal(j)
intent(in) j
do i=j,n
k=index('RE',lit(i)); if (k==0) cycle
if (i+1==n) exit
enddo
internal=k==0
end function
end


lnx:scratch : gfortran blah.f90
lnx:scratch : a.out
4
lnx:scratch :

what do you see when you run your example? What do you expect to see?

FWIW:

lnx:scratch : g95 blah.f90
lnx:scratch : a.out
4
lnx:scratch : lf95 blah.f90
Encountered 0 errors, 0 warnings in file blah.f90.
lnx:scratch : a.out
4
lnx:scratch : pgf90 blah.f90
lnx:scratch : a.out
4


cheers,

paulv

p.s. I assume the lit(i)=line(i:i) is an oversight since i isn't set yet?

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
.



Relevant Pages