erroneous warning about line truncation

Hans Horn hannes@2horns.com
Mon Nov 2 22:23:00 GMT 2009


Steve Kargl wrote:
> On Mon, Nov 02, 2009 at 09:47:03AM -0800, Hans Horn wrote:
>> Steve Kargl wrote:
>>> On Mon, Nov 02, 2009 at 09:03:10AM -0800, Hans Horn wrote:
>>>> Folks,
>>>>
>>>> I get warnings about line truncation on fixed-form (f77) code when I 
>>>> have inline comments starting at column 73 and beyond.
>>>>
>>> Fixed-form code is restricted to 72 columns.  From the Fortran
>>> 2003 Standard.
>>>
>>> 3.3.2      Fixed source form
>>>
>>> In fixed source form, there are restrictions on where a statement mayr
>>> appear within a line.  If a source line contains only default kind
>>> characters, it shall contain exactly 72 characters; otherwise, its
>>> maximum number of characters is processor dependent.
>>>
>>> See the gfortran manual for options that allows you to violate this
>>> restricton.
>>>
>> Steve,
>>
>> line 5 in the mock code I posted emits a warning, while line 4 doesn't.
>> Both lines are more than 72 chars in length.
>>
>>       subroutine foo
>>       IMPLICIT NONE
>>       Integer stupid_dummy_variable1 ! stupid_dummy_variable1
>>       Integer stupid_dummy_variable2 
>> ! stupid_dummy_variable2
>>       Integer stupid_dummy_variable3 
>>  ! stupid_dummy_variable3
> 
> Actually, after I unwrap the two comments (email programs have a funny
> habit of wrapping long lines).  Neither gives a warning.  Of course,
> I simply unwrapped the lines.  You've obviously done something more
> with the above example; perhaps, starting the two comments in
> column 73. Let's see.
> 
> troutmask:sgk[208] nedit fh.f  (unfix to column 73)
> troutmask:sgk[207] gfc4x -c -Wall fh.f
> fh.f:4.72:
> 
>       Integer stupid_dummy_variable2                                    
>                                                                         1
> Warning: Line truncated at (1)
> fh.f:5.72:
> 
>       Integer stupid_dummy_variable3                                    
>                                                                         1
> Warning: Line truncated at (1)
> 
> Yep, the lines of turncated.  RTFM.
> 
> troutmask:sgk[216] gfc4x -c -Wall -ffixed-line-length-none fh.f
> 
> To re-iterate, fixed-form is restricted to 72 columns.  Period.
> 

Steve,

may be I try one more time, this time by attaching the source.
line 5 emits warning, line 4 not - both lines are longer than 72 chars 
if the comments are taken into consideration. the actual statements 
(decls. of stupid_dummy_variable2,3) both end at column 36.

I guess it'll come down to religious interpretation of the standard 
document (which I don't have access to) whether inline comments are part 
of statements or not.

H.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: foo.f
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091102/ff4d68ad/attachment-0001.ksh>


More information about the Fortran mailing list