(j3.2006) EXTERNAL statement in an INTERFACE body
Bill Long
longb
Wed Apr 13 17:21:23 EDT 2016
So, you are saying that the function statement in the interface body does not confer the EXTERNAL attribute on EXT1 in the interface body?
For a point of reference,
> ifort test.f90
test.f90(6): error #6406: Conflicting attributes or multiple declaration of name. [EXT1]
external ext1
---------^
compilation aborted for test.f90 (code 1)
Cheers,
Bill
On Apr 13, 2016, at 4:07 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
> The problem with this analysis is that the EXTERNAL statement is inside
> the interface body, which is a different scoping unit from the one in
> which it is contained. The interface body confers the EXTERNAL
> attribute within the containing scoping unit, and the EXTERNAL statement
> confers the EXTERNAL attribute within the interface body. C514 doesn't
> apply.
>
> I think this needs attention.
>
> On Wed, 2016-04-13 at 21:02 +0000, Bill Long wrote:
>> We also have this constraint:
>>
>> ? C514 An entity shall not be explicitly given any attribute more than once in a scoping unit.
>>
>> So it is not so clear why the EXTERNAL statement is allowed here, since the interface explicitly gives EXT1 the EXTERNAl attribute.
>>
>> "An interface body in a generic or specific interface block specifies the EXTERNAL attribute??
>>
>> Note 5.13 lists the was to give a name the EXTERNAL attribute:
>>
>> "The EXTERNAL attribute can be specified in a type declaration statement, by an interface body (12.4.3.2), by an EXTERNAL statement (12.4.3.6), or by a procedure declaration statement (12.4.3.7)."
>>
>> Cheers,
>> Bill
>>
>>
>> On Apr 13, 2016, at 1:53 PM, Daniel C Chen <cdchen at ca.ibm.com> wrote:
>>
>>> Hello all,
>>>
>>> Is the following code valid?
>>>
>>> program main
>>> real ext, inval
>>> interface
>>> function ext1 (y)
>>> real ext1, y
>>> external ext1
>>> end function ext1 ! Duplicate EXTERNAL attribute
>>> end interface
>>> inval = 1.0
>>> print *, ext1(inval)
>>> end program main
>>>
>>> The EXTERNAL statement is allowed inside an interface body. However, we have a constraint as:
>>>
>>> [16-007: p118] C542 In an external subprogram, the EXTERNAL attribute shall not be specified for a procedure defined by the subprogram.
>>>
>>> It only mentions 'external subprogram'. Should it also include interface body to be consistent?
>>>
>>> Thanks,
>>>
>>> Daniel
>>>
>>> XL Fortran Development - IBM Toronto Software Lab
>>> Phone: 905-413-3056
>>> Tie: 969-3056
>>> Email: cdchen at ca.ibm.com
>>> http://www.ibm.com/software/awdtools/fortran/xlfortran
>>> _______________________________________________
>>> J3 mailing list
>>> J3 at mailman.j3-fortran.org
>>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>>
>> 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
>>
>>
>> _______________________________________________
>> J3 mailing list
>> J3 at mailman.j3-fortran.org
>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
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