On 05/16/2015 08:17 AM, Mikael Morin wrote:
---- snip ----
>>
>> Index: gcc/testsuite/gfortran.dg/continuation_13.f90
>> ===================================================================
>> --- gcc/testsuite/gfortran.dg/continuation_13.f90    (revision 223105)
>> +++ gcc/testsuite/gfortran.dg/continuation_13.f90    (working copy)
>> @@ -19,6 +19,8 @@ character(25) :: astring
>>      )
>>  800 format('This is actually ok.'& !comment
>>     ' end'  )
>> +900 format('This is actually ok.' & !comment
>> +   ' end'  )
>>  write(astring,100)
>>  if (astring.ne."This format is OK.") call abort
>>  write(astring,200)
> 
> Hello, is the new format labelled 900 correct?
> It seems to me it is equivalent to
>       900 format('This is actually ok.' ' end')
> which is missing a comma, no?
> This is a real question, I'm no format guru.

Yes, I agree one ought to use a comma.  See below.

> 
> By the way, the existing 800 format is also not right, it shouldn't have
> a comment, and it should have a '&' at the beginning of the next line.
> Section 3.3.2.4 "Free form statement continuation", last paragraph has:
> 
>> If a character context is to be continued, an “&” shall be the last
>> nonblank character on the line and shall not be followed by commentary.
>> There shall be a later line that is not a comment; an “&” shall be the
>> first nonblank character on the next such line and the statement
>> continues with the next character following that “&”.

The "right" way is to put the "&" at the beginning of the next line.  It is
common practice to allow this as an extension and it is assumed to begin at the
first non-space character encountered.  This does require special handling of
continued literal strings. This is why we try to give errors with -std=f95, etc.

$ gfc -std=f95 continuation_13.f90
continuation_13.f90:24:10:

    ' end'  )
          1
Error: GNU Extension: Missing comma at (1)
continuation_13.f90:41:17:

 write(astring,900)
                 1
Error: FORMAT label 900 at (1) not defined

I think these are cases where even the error detection is not perfect. User 
beware.

> 
> To be honest, I see little value in supporting continuation between the
> two consecutive quotes coding one quote inside a string constant, it's
> confusing.  But if it's supported, the above applies, doesn't it?
> 
> 
> Regarding the patch itself, I haven't looked at it in great details yet,
> but as it's a revert basically, it shouldn't do a lot of harm.
> I see that the fixed form part isn't reverted, is it on purpose?

Fixed form continuations are handled differently and I am not trying to address
issues there, if any.  As I have time, I will dabble further into this.  Getting
ready to move here from Southern California back to Washington State.

Regards,

Jerry

Reply via email to