This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH Fix PR 18537


On Wed, Mar 09, 2005 at 01:46:21PM +0100, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> >     For the type character with kind kind-param, if present, and for type
> >     default character otherwise, a representable character, rep-char, is
> >     one of the following:
> >       (1)  Any character in the processor-dependent character set in fixed
> >            source form.  A processor may restrict the occurrence of some or
> >            all of the control characters.
> >       (2)  Any graphic character in the processor-dependent character set in
> >            free source form.
> > 
> > This means we can choose to issue a warning for *any* tab *anywhere*
> > in the file, because <tab> is a control character, not a graphic character.
> 
> This is interesting, and indeed supports the point of view that a warning is
> in place inside a character string.  Unfortunately, you'd still have to
> identify comments along the way, which can be come cumbersome especially when
> continuation lines get into play.

We can issue a warning for a <tab> character that appears ANYWHERE
in the source code.  See 3.1.5 Other Characters, 3.3.1.1 Free Form
Commentary, and 3.3.2.1 Fixed Form Commentary.  Note the conspicious
absence of a statement of the form "All characters in the default
character type shall be allowed in comments."  In fact, 3.1.5 Other
Characters states "... but may appear only in comments".
Note the use of "may".  Also, note that <tab> is a control charcter
not an "Other Character".

> > 
> > Well, my current patch (while not perfect) found 21 programs in 
> > the testsuite that had illegal tab characters.  One program,
> > 19990826-3.f, contained a leading tab in every line that wasn't
> > a comment or labeled.
> 
> ... which doesn't show that it was indeed a problem :-)

It depends on your definition of problem.  21 illegal programs
in a test suite that is testing the correctness of a fortran
processor and that have managed to survive for several years
seems to cast a shadow on the quality of implementation.  BTW,
these aren't the only illegal programs I've found in the test
suite. 

> WRT why I think this warning doesn't buy us much, enjoy my not well-researched
> argument:  I don't see how the standard forbids tabs (outside strings).  If we
> interpret tabs as 'as many blanks as needed to go to the next column which is
> a multiple of 6 plus 1', I think we might well be within the domain of the
> standard.

Read 3.1.  A <tab> character is a control character.  The
"Fortran character set" includes letters (3.1.1), digits
(3.1.2), underscore (3.1.3), and special characters (3.1.4).
<tab> isn't a member of any of these 4 categories. 

Finally, if -std=f95 means strict Fortran 95 semantics, then
the warning should probably be an error.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]