[Patch, fortran] PR19260 & not required when splitting a token in continuation

Jerry DeLisle jvdelisle@verizon.net
Thu Sep 21 03:29:00 GMT 2006


Tobias Burnus wrote:
> Hello,
> 
> 
> Not looking at the patch itself, only at the test case, I have a comment
> 
> Jerry DeLisle wrote:
>> ------------------------------------------------------------------------
>>
>> ! { dg-do run }
>> ! { dg-options -Wampersand }
>> ! PR 19101  Test line continuations and spaces.  Note: the missing ampersand
>> ! before "world" is non standard default behavior.  Use -std=f95, -std=f2003,
>> ! -pedantic, -Wall, or -Wampersand to catch this error
>> ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
>> program main
>>   character (len=40) &
>>   c                 ! { dg-warning "Warning: Missing '&' " }
> 
> I fail to see why gfortran should emit a "Warning: Missing '&' " here.
> 
> 
>>   c = "Hello, &
>>          world!"    ! { dg-warning "Warning: Missing '&' " }
> (ok; the missing & is an error; a (default?) warning might be ok as well)
> 
> 
>>   if (c.ne.&
>>   "Hello, world!")&
>> call abort()        ! { dg-warning "Warning: Missing '&' " }
> 
> whereas here I also miss why gfortran should emit a warning.
> 
> 
> 
>> ------------------------------------------------------------------------
>> ! { dg-do compile }
>> ! PR 19260  Test line continuations and spaces.
>> ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
>> x = si&
>> n(3.14159/2)
> I don't understand why there is is no warning/error/unclassifiable
> statement here.
> 
>> y = co&  ! { dg-error "Unclassifiable statement" }
>>  s(3.14159/2)
>> end
> ("Unclassifiable statement" looks ok to me)
> 
> 
> As I understand Fortran 2003, section 3.3.1.2, a single & at the end of
> a line is enough (unless see next paragraph), which should be the case
> for the "character (len=40) & c" and for "if (c.ne. & "Hello, world!")&
> call abort()". I thus see no reason that gfortran should warn.
> 
> For lexicographic tokens there needs to be "&" in the succeeding line thus
> "x = si&
> n(3.14159/2)" would be invalid (missing "&" before the "n").
> For "character contexts": same as for lexicographic tokens.
> 
> Tobias
> 
Good comments, the revised patch I submitted catches the split token case.

Also, I got carried away with the warnings on missing '&' so I will fix that and 
submit another version of the patch.  (Too busy tonight to do this, but will get 
back to it hopefully Friday.)

Tobias, thank you very much for the comments!

Jerry



More information about the Fortran mailing list