cluelesscompiler
Programmer
Hi.
I'm trying to compile some legacy code with g77 on a PC under the MinGW environment. When I compile the source file with a .f extension, it does not compile. I get a massive number of errors saying "zero-size array". It does not matter whther or not the array is singly or multiply indexed. The program makes heavy use of COMMON blocks, in which variables are dimensioned using integer variables, e.g.,
COMMON / ABC / A(N1), B(N2), C(N3)
where N1, N2, N3 are specified in an INCLUDE file. It seems as though the N1, N2, N3 values are not being applied to the variables in the common blocks.
The IINCLUDE file might look like this:
parameter (nxt = 150, nyt = 30, nzt = 80)
parameter (nsh = 50)
parameter (nhs = 1, nvs = 1, nbd = 1)
parameter (nxtm = nxt-1, nytm=nyt-1, nztm = nzt-1)
parameter (nmds = 12)
parameter (nmds2 = 2*nmds)
parameter (nhcs = 3)
parameter (nlt = 2*nyt + 2*nzt)
parameter (nmpt = 5, napt = 5)
A COMMON block might look like this:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
and the error might look like:
captsdv25.f:9898:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
^
Zero-size array at (^)
captsdv25.f:9898:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
^
Zero-size array at (^)
Now here's what blows my mind. If I rename the source file to end with a .for extension, it compiles and executes just fine. Obviously I am missing something fundamental.
Can anyone help stop my spinning head?
I'm trying to compile some legacy code with g77 on a PC under the MinGW environment. When I compile the source file with a .f extension, it does not compile. I get a massive number of errors saying "zero-size array". It does not matter whther or not the array is singly or multiply indexed. The program makes heavy use of COMMON blocks, in which variables are dimensioned using integer variables, e.g.,
COMMON / ABC / A(N1), B(N2), C(N3)
where N1, N2, N3 are specified in an INCLUDE file. It seems as though the N1, N2, N3 values are not being applied to the variables in the common blocks.
The IINCLUDE file might look like this:
parameter (nxt = 150, nyt = 30, nzt = 80)
parameter (nsh = 50)
parameter (nhs = 1, nvs = 1, nbd = 1)
parameter (nxtm = nxt-1, nytm=nyt-1, nztm = nzt-1)
parameter (nmds = 12)
parameter (nmds2 = 2*nmds)
parameter (nhcs = 3)
parameter (nlt = 2*nyt + 2*nzt)
parameter (nmpt = 5, napt = 5)
A COMMON block might look like this:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
and the error might look like:
captsdv25.f:9898:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
^
Zero-size array at (^)
captsdv25.f:9898:
common / bodybc / fbtnp(nxt,nyt,nbd), fbbnp(nxt,nyt,nbd)
^
Zero-size array at (^)
Now here's what blows my mind. If I rename the source file to end with a .for extension, it compiles and executes just fine. Obviously I am missing something fundamental.
Can anyone help stop my spinning head?