[J3] an amusing mistake
Bill Long
longb at cray.com
Tue Aug 4 11:10:43 EDT 2020
> On Aug 4, 2020, at 9:58 AM, Robert Corbett via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> Oops. After fixing my mistake,
> the second program violates C725, which states
>
> C725 (R722) The optional comma
> in a /length-selector/ is permitted
> only if no double-colon
> separator appears in the
> /type-declaration-stmt/.
The extra comma did seem very weird. I never see programs use that in practice, and am unclear why it is even allowed. I assume it is a relic of fixed-source form, which is Obsolescent. (Of course, CHARACTER* is also obsolescent, but I do still see that in very old codes.) Indeed, C725 is in tiny (obsolescent) font.
> The type-declaration-stmt in the
> second program contains a
> double-colon separator, and so
> the optional comma should not
> appear.
>
> I have no doubt that the intent was
> to ban the optional comma only if
> the double-colon precedes the
> /entity-decl-list/, but that is not
> what the constraint says.
Perhaps a more reasonable solution would be to just move the optional comma to the Deleted List. (Hence deleting the constraint).
Cheers,
Bill
>
> Bob Corbett
>
>> On Aug 4, 2020, at 6:27 AM, Bill Long via J3 <j3 at mailman.j3-fortran.org> wrote:
>>
>>
>>
>>> On Aug 4, 2020, at 6:29 AM, Robert Corbett via J3 <j3 at mailman.j3-fortran.org> wrote:
>>>
>>> In the past few days, I had reasons to read
>>> the Fortran 2018 standard more closely than
>>> I usually read it. As often happens when I
>>> read the standard closely, I saw problems
>>> that I overlooked before. Yesterday, I saw
>>> a problem I found amusing. (Yes, I am
>>> easily amused.)
>>>
>>> Consider the two programs
>>>
>>> -------------------------------------------
>>> PROGRAM ONE
>>> CHARACTER*1, C(SUM([1]))
>>> END
>>> -------------------------------------------
>>> PROGRAM TWO
>>> CHARACTER*1, C(SUM([INTEGER:: 1])
>>> END
>>> -------------------------------------------
>>>
>>> The first program is standard conforming.
>>> The second program is not a conforming
>>> program under a strict reading of the
>>> standard.
>>
>> Or not so strict. It is not conforming because of a missing right paren at the end of the second statement.
>>
>> With that syntax error fixed, both compile for me.
>>
>> Cheers,
>> Bill
>>
>>
>>
>>> Both programs should be
>>> standard conforming.
>>>
>>> I suspect there are compilers that
>>> accept both programs and other compilers
>>> that reject both programs. I doubt there
>>> are any compilers that accept the first
>>> program and reject the second.
>>>
>>> Bob Corbett
>>>
>>
>> Bill Long longb at hpe.com
>> Engineer/Master , Fortran Technical Support & voice: 651-605-9024
>> Bioinformatics Software Development fax: 651-605-9143
>> Hewlett Packard Enterprise/ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
>>
>>
>>
>>
>
Bill Long longb at hpe.com
Engineer/Master , Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Hewlett Packard Enterprise/ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list