(j3.2006) FW: 11-229 J3 Fortran interp letter ballot #24 - due 19-Aug-2011 - 2nd try
Bill Long
longb
Thu Aug 18 22:48:23 EDT 2011
On 8/18/11 9:17 PM, Malcolm Cohen wrote:
> Bill Long wrote:
>> Comment for F03/0120:
>> --------------------------------
> ...
>> Finally, the text of the subsequent subroutine S contains:
>>
>> SUBROUTINE S(N)
>> USE M1, T1=>T
>> USE M2, T2=>T
>> TYPE(T(N)) :: X
>> TYPE(T(N)) :: Y
>> Y%A = 0.0
>> X = Y
>> END
>>
>> which seems baffling. With the type T from each of the modules renamed to T1
>> and T2 locally, there is no type named T visible here. Yet the declarations of
>> X and Y both use type T(N). The compiler was displeased.
>
> Clearly (!) X and Y should be declared with T1 and T2 not T, otherwise there is
> no question of whether they are the same type or not.
>
>> I think the following alternative demonstrates what was intended (and also
>> seems to compile and execute as one might expect):
>
> Except that
> (a) it does not demonstrate the question as there are no sequence types with the
> same name, therefore no sequence types that might be the same type,
> and
> (b) it is straightforwardly invalid as the derived-type definitions don't
> specify the same name as required by 4.5.2.4p2; I hope your compiler catches
> that if they are module procedures!
Good point, though the same name requirement seems a bit artificial in
the alternative program since the names of types defined in a subprogram
are local the the subprogram. However, if you change the declarations
in the original example to T1 and T2 (different names), then the types
of X and Y already run afoul of this rule, so the point of the example
seems to get lost. Either way, the example looks broken.
Cheers,
Bill
>
> Cheers,
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list