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


Steve Kargl wrote:
> 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".

I'm not a native speaker, but to me (in the context of a standard at least)
'may appear' means 'a program in which they appear is conforming'
>From how I read 3.1.5, if '\t' is in the processor character set, they may
appear in character constants and comments.

>  Also, note that <tab> is a control charcter
> not an "Other Character".

There is no category of control characters in Fortran.  '\t' is a "Other
character".  If you disagree, and say that '\t' shouldn't be considered as
such, I don't see how the standard makes any statement about them, and how you
can rule out a translation of '\t' into characters that are part of the
processor character set (e.g. blanks).

(BTW, interesting but unrelated, I could find no mention of how lines are to
be separated, i.e. there's no mention of the newline character.)

> 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.

There are two kinds of possible problems that I meant:
 - testsuite problem: this isn't a testsuite problem because the testsuite
   tests the GNU Fortran language, in which we treat tabs as another kind of
   blanks except in the first six columns of fixed form source where we
   interpret  them as "enough blanks to go to column 7"
 - portability problem: is there a compiler which doesn't accept tabs?  In
   what contexts?
 - language conformance: I'd buy the argument that '\t' tabs are not allowed.
   But *only* outside character constants and comments.

>>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. 

See above.  I think this reasoning is fallacious.

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

Agreed.  Iff we can determine from the standard that '\t' is not an allowed
character and where precisely it is not allowed.

I have done some searching around on comp.lang.fortran, and couldn't find
anything which explicitly allows or disallows tabs.  But there are several
postings by people such as Richard Maine, see e.g.
<http://groups-beta.google.com/group/comp.lang.fortran/messages/3cc60078507be78d,7b9d543632fcf9c5,fa7bea6bc59064e2,f6d9887258814a48,02757d4d3c3bf4ff,4ed90b3164fd1971,927dcfe3833aa466,8c35415857bd9095,7f0d9ec3adc62d8d,c60406ed14787d9b?thread_id=44de424838844aee&mode=thread&noheader=1&q=tab+character+source#doc_02757d4d3c3bf4ff>,
where they dicuss the pros and cons of using tabs.

- Tobi


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