[J3] an amusing mistake
Robert Corbett
rpcorbett at att.net
Tue Aug 4 10:58:40 EDT 2020
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 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.
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
>
>
>
>
More information about the J3
mailing list