------- Comment #2 from burnus at gcc dot gnu dot org  2009-02-18 16:41 -------
> I'm not sure if this kind of thing is legal to begin with

Well, the Fortran standard only has:

Free form: "If a line consists entirely of characters of default kind (4.4.4),
it may contain at most 132 characters. If a line contains any character that is
not of default kind, the maximum number of characters allowed on the line is
processor dependent." [3.3.1]

Fixed form: "If a source line contains only default kind characters, it shall
contain exactly 72 characters; otherwise, its maximum number of characters is
processor dependent."

Thus a conforming program may not have more than 72/132 characters in a line
(incl. comments) and this is no issue. The standard does not write anything
about what the compiler has to do.

Common is that 73+ characters are ignored in fixed form and thus several people
used it to put comments there. Additionally, everyone assumes that longer lines
are OK as long as long as there is a "!" before 72/132. (-> all compilers I
know do so).

As free form indicates non-legacy code and as F90 has "!" comments, the
truncation trick wont work. Some compilers truncates, some give an error, some
a warning (and stop - or continue reading the line) and some simply read on.

gfortran does: Fixed form: Truncating + optional warning
               Free  form: Truncating + default-on warning
               optionally: Accept longer lines ("n" characters or "infinity")


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39229

Reply via email to