[Patch, Fortran] PR32987 - Allow TAB in FORMAT statements as extension and warn with -std=f*

Tobias Burnus burnus@net-b.de
Sat Aug 4 17:37:00 GMT 2007


:ADDPATCH fortran:

In FORMAT statements, standard Fortran only allow tabs ('\t') in string
literals. However, all other compiler I checked allow it: ifort, g95,
NAG f95, sunf95, openf95. Except of ifort (with the option "-stand f95")
none of the compilers even print a compile-time warning.

gfortran currently accepts tabs quietly at compile time, but gives a
run-time error.

Given that all other compilers allow it, I would suggest to allow it as
well - and follow ifort by giving a warning with -std=f95/f2003.
(Actually, I have chosen to give a gfc_warning instead of an gfc_error
to save myself from several levels of error propagation :-)

Note, however, that Steve disagrees (see PR for full quote):

"A tab is not a legal substitution for a space character." [...]
"Here's a patch that permits gfortran to accept your INVALID code."
(His patch is the same as the libgfortran part of my patch; he continues
then:)
"[...] I will activity oppose application of this patch by others."

Reasoning by Steve:

"gfortran has been around for a long time now and this is the first
report of the tab-in-format runtime error. gfortran should complain
loudly that the code is invalid."


While I still think accepting it with a compile-time warning is enough,
I strongly believe that there should be in any case a COMPILE-TIME
diagnostic whatever we decide about accepting or rejecting it at run time.


Build and regression tested on x86_64-unknown-linux-gnu.


Let the discussion start ...

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tab.diff
Type: text/x-patch
Size: 1687 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070804/fef5b6b2/attachment.bin>


More information about the Fortran mailing list