[RFC][PATCH] -d_lines

Brooks Moses bmoses@stanford.edu
Wed Aug 17 09:33:00 GMT 2005


Bernhard Fischer wrote:
> Several "ancient" fortran programs do exercise -- as well as most
> commercial compilers do support -- a variant of fixed-mode where 'D'
> resp. 'd' in the first column of source is either treated as comment --
> per default -- or as code -- if the compiler sees an argument akin to
> -d_lines.
[...]
> +++ gcc/fortran/lang.opt	16 Aug 2005 17:03:42 -0000
[...]
> +d_lines
> +F95
> +Treat lines with 'd' in column 1 as code
[...]
> +++ gcc/fortran/scanner.c	16 Aug 2005 17:03:42 -0000
[...]
> +	    /* d_lines is set, treat line as code and eat the identifier.  */
[...]

The more times I look at this description (and the line of 
documentation), the less sure I am about the answer to the following 
question: Are the column numbers in a "D" line expected to be the same 
as a normal code line (and thus the "D" replaces the blank first 
character), or are they shifted over by one as if the "D" is _inserted_ 
at the front of the line?

(The "eat the identifier" in the code comment really suggests that one 
is removing an _inserted_ "D" and treating the rest of the line as 
shifted over by one, which I suspect is incorrect.)

Also, I would think that the documentation line should be "Treat lines 
with 'D' or 'd' in column 1 as code", since you propose to allow both cases.

On the programming end: Have you checked to confirm that your code 
produces the correct column location for error messages when there is an 
error in a "D"-prefixed line?  This seems to me a likely place for an 
off-by-one problem to be introduced, and I'd think it would be good to 
include a check for this in the eventual testcases.

- Brooks



More information about the Fortran mailing list