Take the 2-minute tour ×

I am trying to understand a Fortran code written by someone else. The code is doing what it is supposed to do so I am assuming that it works fine. A subroutine called "fft" is being called from another subroutine called "convol". Inside "convol", an array is declared like this:

real, dimension fri(n+1,n,nh,2,0:1)
call fft(fri)

Inside "fft", the declaration is like this:

subroutine wrft3b(fri) 
real, dimension fri(2,n+1,n,nh,0:1) 

I don't understand why the array lengths are not consistent and still the code is working. Any clues what might be happening here?

share|improve this question

1 Answer 1

The important thing is that the length is the same. If the interface is not explicit, this will not throw an error for the contiguous explicit-shape array. Only the elements of the array will have different indexes (determined by the column-major order), that in the calling program.

share|improve this answer
so most likely in the code, the original author is doing something tricky with the data by changing the indices automatically between the two subroutines? Also, I am sorry but I didn't understand. What did you mean by "interface is not explicit"? –  jhaprade Mar 1 '13 at 9:03
Explicit interface is a term from Fortran 90, the interface to a subroutine is explicit, if the called routine is internal to the calling routine, it is a module procedure, or an interface block is provided. Any modern code should be done to always provide explicit interfaces. –  Vladimir F Mar 1 '13 at 9:23
Otherwise yes, the author probably changes the indexing of the array. –  Vladimir F Mar 1 '13 at 9:25
The explicitness/implicitness of the interface is not relevant here - a compiler that threw an error with a explicit interface accessible with the code shown would be a broken compiler. –  IanH Mar 3 '13 at 22:53

Your Answer


