I am having some trouble with old fortan code that I want to compile on gfortran.
INTEGER NEQ
DOUBLE PRECISION RE
COMMON /DM18J/ RE,NEQ
CALL FUNC(NEQ,RE)
The problem with the code is that the function assumes that RE is an array of size NEQ. However, I cannot specify beforehand the size of the array because it comes from the common block.
As the code is quite lengthy I was hoping to fix yhis without resorting to module variables. A thing that I might want to try is to insert NEQ as an argument instead of getting it via the common block.
If RE is an array, then it should be declared as such. Say, for argument, it is of size 100
When calling your routine, you need to specify the size of the array the function needs to operate on. This is not necessarily the size of the array. Your array could have 10000 elements but if you only wish to operate on the first 2, just set NEQ to 2.