I am trying to debug my code that involves a subroutine and a module. I get two error messages from the subroutine : 1) Symbol is not a dummy variable, 2) Legacy Extension : REAL array index. I indicate in the code where the errors come from.
The main program reads in a file with one column of numbers. I then CALL the subroutine using this file as the argument. The sub-routine then gives me these two error messages. How can I fix my code and thus fix these error messages? Thanks
Note : I edited the code based on the useful comment below. I still get the same error messages.
MODULE Stack1
IMPLICIT NONE
INTEGER, PARAMETER:: nx = 48, ny = 48
CONTAINS
SUBROUTINE Stack2
REAL,DIMENSION(-nx:nx,-ny:ny),INTENT(INOUT):: f !produces error message 1)
REAL :: x0,y0,x1,y1,x,y,a0,a1,a2,a3,nstep,dx,dy
INTEGER :: i
DATA x0,x1,y0,y1,nstep/0.d0,1.d0,0.d0,1.d0,10/
p(x,y)=a0 +a1*x+a2*y+a3*x*y !interpolant polynomial
!now evaluate the function f on the 4 known grid points
!use this to solve for the unknown interpolant coefficients a0,a1,a2,a3
a0=(f(x0,y0)*x1*y1-f(x1,y0)*x0*y1+(f(x1,y1)*x0-f(x0,y1)*x1)*y0 )/&
(x1*y1-x0*y1+( x0-x1 )*y0 ) !produces error message 2)
a1=(f(x1,y0)*y1-f(x0,y0)*y1+(f(x0,y1)-f(x1,y1))*y0 )/&
(x1*y1-x0*y1+( x0-x1 )*y0 ) !produces error message 2)
a2=(f(x0,y1)*x1-f(x0,y0)*x1+(f(x1,y0)-f(x1,y1))*x0 )/&
(x1*y1-x0*y1+( x0-x1 )*y0 ) !produces error message 2)
a3=(f(x1,y1)-f(x1,y0)-f(x0,y1)+f(x0,y0) )/&
(x1*y1-x0*y1+( x0-x1 )*y0 ) !produces error message 2)
DO i=0,nstep
x=x0+dx*FLOAT(i)
y=y0+dy*FLOAT(i)
y=0.75d0*y1
print 100,x,y,p(x,y),f(x,y)
20 continue
100 format('x,y,p,f=',4(3x,e10.3))
END DO
END SUBROUTINE Stack2
END MODULE Stack1
PROGRAM StackProblem
USE Stack1
IMPLICIT NONE
INTEGER :: i,j
REAL,DIMENSION(-nx:nx,-ny:ny) :: Func
OPEN(UNIT=11, file='TestFile1.dat',status='old')
DO i=-nx,nx
DO j=-ny,ny
READ(11,*) Func(i,j)
END DO
END DO
CALL Stack2(Func)
END PROGRAM StackProblem
Note, the file TestFile1.dat is just a single column file with real numbers in it, for ex:
1.30482
1.30787
1.31098
1.32983
implicit noneright after themoduleline and get the compiler to check for a common source of errors. Personally I think you're wasting your time developing code without that safety harness; you can probably guess my thinking on my time too :-)subroutine stack2(f).