"d" label in the first column, Fortran 77
Asked Answered
G

1

5

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:

  1. the meaning of this label;
  2. why it is only recognized by ifort and;
  3. how I can make it work with gfortran.
Guddle answered 21/4, 2015 at 12:11 Comment(0)
A
7

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.

Alisaalisan answered 21/4, 2015 at 12:26 Comment(1)
Needless to say, with new code there are much better ways of doing this.Alisaalisan

© 2022 - 2024 — McMap. All rights reserved.