I am modifying a code from a model written in Fortran 77, but I have come across an odd thing to me. In some files, there is a label "d" in the first column of a line, like the example below:
d real*8 co2rootfix,co2rootloss,co2shootfix
d character komma*1
d open(unit=87,file='crop_CO2.csv',status='unknown')
d write(87,*) 'date,co2rootfix,co2rootloss,co2shootfix'
d open(unit=88,file='crop_dm.csv',status='unknown')
d write(88,*) 'date,wrtpot,wrt,wstpot,wst,rdpot,rd,laipot,lai,
d &gwrt,gwst,drrt,drlv,drst'
The weird thing is that it is successfully compiled by Intel's ifort compiler. However, gfortran logically returns the following error:
Error: Non-numeric character in statement label at (1)
I would like to know:
From the ifort documentation there are the options -d-lines
and -nod-lines
:
This option compiles debug statements. It specifies that lines in fixed-format files that contain a D in column 1 (debug statements) should be treated as source code.
So, if the code is compiled without -d-lines
(or with -nod-lines
which is the default) then those lines with d
in the first column in treated as comments and ignored.
In gfortran -fd-lines-as-code
and -fd-lines-as-comments
have the same effect. The difference here is that ifort, as an extension, accepts the code regardless of flags (as above, it has the implicit -nod-lines
). gfortran requires exactly one of the flags to be specified to accept the code.