Topic: legacy program issue, arrays

I have an issue with my "old" legacy program. This program was compiled on another older compiler and is used since 20 years or so.
I compiled it now new with Simply Fortran, but I get in one case wrong calculation results. The reason for, an array is not correctly read from the data file in Simply Fortran.

Array specification in F77, within an include file:

PARAMETER (MAXTU=10,MAXAOR=30,MAXN1S=80)
COMMON/TURKEN/RN1S(MAXTU,MAXAOR,MAXN1S)

If i read data for this array from an input file, the correct array size and data are used with the old compiler. But with Simpy Fortran i get an array size (MAXTU=80,MAXAOR=30,MAXN1S=10) instead, and the data values are not correctly read from the data file.
Does anyone had a similar problem?

Erwin

Re: legacy program issue, arrays

Just to clear things up, Erwin is seeing the wrong dimensions in the debugger.  The debugger is interpreting the array order in C's row-major ordering, but Fortran is indeed storing it in column-major ordering.  Adding the statement:

Write(*,*) SIZE(RN1S, 1), SIZE(RN1S, 2), SIZE(RN1S, 3)

indeed shows the output:

         10          30          80

Meaning that the array is sized as expected.  The debugger's output is unexpected, but explainable as a difference between how the C-centric debugger expects data to be stored in memory and how Fortran is actually storing data.

Jeff Armstrong
Approximatrix, LLC

Re: legacy program issue, arrays

Hello Jeff,
Thanks for clarification.