Scientific Fortran Build Error

I am working on a scientific modeling program and I also want my program to even compile. I did not touch the code that my professor insists on earlier, only the makefile. After many further attempts, I received this error:

Error on line 1112: Declaration error for xxmf: adjustable dimension on non-argument upcase: intrpl: splin: mtrnpr: 

My professor insists that this is just a compilation problem and that there should be some option with global variables that I can use, and this will fix it. The closest I found uses the parameter

  -Mipa=safeall 

in the makefile, but I'm not sure if I put it in the right place or if it matters, as I still get the same error.

+4
source share
1 answer

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.)

+11
source

Source: https://habr.com/ru/post/1340691/


All Articles