(j3.2006) nonstandard specifics of standard intrinsic generics

Robert Corbett Robert.Corbett
Fri Apr 25 20:12:43 EDT 2008


Bill Long wrote:
> 
> 
> Robert Corbett wrote:
> 
>> Malcolm Cohen wrote:
>>
>>  
>>
>>> On Thu, 17 Apr 2008 18:16:21 +0900, Robert Corbett 
>>> <Robert.Corbett at sun.com> wrote:
>>>
>>>    
>>>
>>>> I stated that the implementation provides a nonstandard specific
>>>> interface for SQRT that takes an INTEGER argument.  That interface
>>>> conflicts with the specific interface of the generic interface.
>>>> The characteristics of the nonstandard intrinsic procedure and the
>>>> procedure in the interface do not differ as specified in 16.2.3.
>>>> Therefore, constraint C547 is violated.
>>>>       
>>>
>>> No.  If the user provides a specific that would override some
>>> "specific" of an intrinsic, that intrinsic specific is not part
>>> of the generic identifier (it is inaccessible by that generic name).
>>>     
>>
>>
>> I assume you are using the word "inaccessible" is a different sense
>> than the sense of its use in the second sentence of the first
>> paragraph of Section 16.2.3 of Fortran 2003.  I assume that the
>> sense you intend is that, for the purpose of the conditions set
>> out in constraint C547 in Section 5.1.2.8 of Fortran 2003, it is
>> as if those "specific intrinsic procedures" do not exist in the
>> scoping unit.
>>
>> If that is the case, is it possible for a program to violate
>> constraint C547?  Constraint C547 states
>>
>>       C547 (R503) (R1216)  If the name of a generic intrinsic
>>            procedure is explicitly declared to have the
>>            INTRINSIC attribute, and it is also the generic
>>            name in one or more generic interfaces (12.3.2.1)
>>            accessible in the same scoping unit, the procedures
>>            in the interfaces and the specific intrinsic
>>            procedures shall all be functions or all be
>>            subroutines, and the characteristics of the
>>            specific intrinsic procedures and the procedures in
>>            the interfaces shall differ as specified in 16.2.3.
>>
>> For example, based on my understanding of what you wrote, the
>> program
>>
>>        PROGRAM MAIN
>>          INTRINSIC SQRT
>>          INTERFACE SQRT
>>            REAL FUNCTION MY_SQRT(X)
>>            END FUNCTION
>>          END INTERFACE
>>        END
>>
>> would not violate constraint C547 because the specific interface
>> for MY_SQRT in the generic interface would mask the specific
>> intrinsic procedure with the same characteristics as MY_SQRT.  If
>> the constraint does not apply in that case, I do not see how it
>> can ever apply to any code.
>>   
> 
> 
> How about this one:
> 
> program test
> intrinsic sqrt
> interface sqrt
>   subroutine my_sqrt(x)
>   end subroutine
> end interface
> end program

Good point!

So it is only the final part of constraint C547 that speaks about
characteristics that is pointless under Malcolm's interpretation.

Bob Corbett



More information about the J3 mailing list