(j3.2006) EXTERNAL statement in an INTERFACE body
Van Snyder
Van.Snyder
Wed Apr 13 17:07:58 EDT 2016
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
More information about the J3
mailing list