------- Comment #9 from burnus at gcc dot gnu dot org 2008-01-22 09:30 ------- Patch was: http://gcc.gnu.org/ml/fortran/2008-01/msg00261.html FIXED on the trunk (4.3.0).
Manfred Schwarb wrote: > I like the idea of being able to compile also legacy code with gfortran. > However, I really see the point Steve is making. With this patch things > get confusing. I do not think so. We were supporting "<tab>" before - and giving a warning with -std=f95/f2003 or -pedantic; except that we were not supporting <tab><digit> for continuation lines. g77, NAG f95, ifort, openf95, sunf95, pgf90, absoft, pathscale all support both <tab> for "normal" lines and <tab><digit> for continuation lines. I do not see why this patch changes the default behaviour of gfortran in this regard. > c23456789012345678901234567890123456789012345678901234567890123456789012 > integer aaaaaaaaaaaa, bbbbbbbbb, cccccccc, dddddddddd, eeeeeeee, f > 1gggg gfortran currently cuts off (by default) everything after 72 characters; thus for the spaces version have the variable "f" and an invalid "1gggg" line. But this is unchanged by my patch. The spaces version of your example compiles only with g77 - and it does not compile if one adds an "implicit none" ("Invalid declaration of or reference to symbol `f1gggg'"). With all my other compilers it gives a compile error. The g77 error message indicates that it also regards 6 spaces + digit as a continuation line. > If you write this with tabs, then the program becomes invalid. No, it becomes valid (though not a valid by the Fortran standard) as without "implicit none" one defines the variable "fgggg" and the variable "f1gggg" is then implicitly typed. > Secondly: Tradition in gfortran was to bury such things behind -std=legacy. > There are other things which are supported by other compilers and g77 If you want, you can submit a patch which hides general "<tab>" support behind -std=legacy. (I do not see why <tab> should be supported by default while <tab><digit> should only be supported with -std=legacy.) * * * My added comment of yesterday somehow vanished; re-add some bits: > The code is non-conforming. Agreed - <tab><digit> and <tab> are non-standard Fortran, even though they are widely supported. > I downloaded the FITS package, and it's worse than I thought. Indeed: None of my 6 compilers is able to compile it - and I do not intent to make gfortran compile it. (gfortran now compiles as fas as NAG f95 and after one line change (realvar = ' ') as far as ifort, which should be enough.) The advantage of <tab><digit> is that is both widely used and rather unambiguous. The other failures look rather like bugs and I do not know what a sensible compiler could do (other than rejecting it). > If I understand correctly, you want to change gfortran to parse a leading > tab as 5 spaces if it is followed by digit; otherwise, the leading tab is > parsed as 6 spaces. Kind of. Before my patch, gfortran replaced a <tab> in the first 7 columns replacing it by up to 7 spaces, i.e. "<tab>", " <tab>", " <tab>" and " " are treated identical. With the patch only 6 columns are regarded and if the next digit after the tab is a digit, it is moved to the 6th column. -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Keywords|rejects-valid | Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34899