Oof. It looks like you have old code that works great with your supervisor on a specific version of the old f77 compiler, but it will cause you great pain when you slowly bring it to standard, the compiler compilers will do the right thing.
Custom arrays are such things:
subroutine mysub(a,n) integer n real a(n)
- that is, by passing arrays more or less the way you do in C. Fortran90 and beyond, you can use arrays of intended forms
subroutine mysub90(a) real a(:) n=size(x,1)
which is much cleaner since the compiler provides the correct array size.
So it looks like your supervisor code uses this construct in what is not an argument in the routine, perhaps as a way to create arrays of a certain size at runtime. The standard Fortran77 never allowed this, but several compilers made it as extensions. Fortunately, you can now use distributed arrays as a standard way to do this, so I would suggest just changing the variable that gives you grief now in the allocated array.
By the way, there are many tools for analyzing static code that will allow you to actively search for such problems and track them. Understanding is a good commercial option with an evaluation license of ~ 2 weeks, which will find many problems. Forcheck , although not very user friendly, is very thorough. Using tools such as dragging your supervisor code with your feet and screaming in 2010 will be a short word, but it will be a great investment for your time. Another good toolkit is eclipse + photran , but unfortunately, in most cases, it is assumed that you have good fortran90 code - it will be some time before you can use that.
(And before anyone starts making snarky comments about fortran - yes, yes, there are a lot of old crappy fortran code, but this is hardly unique to fortran now.)