I'm working on scientific modelling program and have yet to get my program to even compile. I haven't touched the code which my professor insists previously worked, only the makefile. After many attempts, the furthest I've gotten was this error:
Error on line 1112: Declaration error for xxmf: adjustable dimension on non-argument
upcase:
intrpl:
splin:
mtrnpr:
My Professor insists that it's merely a compiling problem and that there should be some option involving global variables that I can use that'll fix this. The closest I've found is using the option
-Mipa=safeall
in the makefile, but I'm not sure if I'm putting it in the right place or if it made a difference since I still get the same error.
Oof -- Sounds like you have an old code which works fine with your supervisor's particular version of an ancient f77 compiler, but is going to cause heartache for you for a while as you slowly bring it up to standard so that standards-compilant compilers will do the right thing.
Adjustable arrays are things like this:
subroutine mysub(a,n)
integer n
real a(n)
-- which is to say, passing arrays more or less the way you do in C. Fortran90 and onwards allows you to use assumed-shape arrays
subroutine mysub90(a)
real a(:)
n=size(x,1)
which is a lot cleaner, as the compiler is ensuring the correct size of the array is being passed.
So it sounds like your supervisor's code is using this sort of construct in something that isn't an argument in a subroutine, presumably as a way of creating arrays of a particular size at runtime. Standard Fortran77 never allowed that, but several compilers did as extensions. Luckily, you can use allocatable arrays now as a standard way of doing this, so I'd suggest just changing the variable giving you grief now to an allocatable array.
Incidentally, there are a lot of static code analysis tools out there that will allow you to proactively find problems like this and track them down. Understand is a good commercial one with a ~2 week evaluation license that will find a lot of problems. Forcheck, though not nearly as user friendly, is very thorough. Using tools like these to drag your supervisors code kicking and screaming into the 2010s will be a bit of a slog, but it'll be an excellent investment of your time. Another good set of tools is eclipse + photran, but unfortunately that already mostly assumes you have nice fortran90 code -- it'll be a while before you can be using that.
(And before anyone starts making snarky comments about fortran -- yes, yes, there's a lot of old crappy fortran code out there, but that's hardly unique to fortran now, is it.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With