On Thu, Mar 21, 2019 at 09:04:21PM +0100, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 20 Mar 2019 11:07:31 +0100, I wrote:
> > On Fri, 26 Aug 2016 08:16:43 -0700, Cesar Philippidis 
> > <ce...@codesourcery.com> wrote:
> > > While working on [...], I noticed
> > 
> > If only all such issues would end up in their own PRs, instead of mixing
> > them with other changes...
> > 
> > > that the fortran FE wasn't permitting
> > > named functions inside acc routine directives. E.g.
> > > 
> > >   integer :: foo
> > >   !$acc routine(foo) gang
> > > 
> > >   ... = foo ()
> > 
> > ACK.  Perhaps not the most pretty style, but gfortran does accept this.
> > 
> > Do I understand right that there exists no equivalent syntax in Fortran
> > to declare a subroutine (instead of a function) with implicit EXTERNAL
> > attribute?  (See also the new 'gfortran.dg/goacc/pr89773.f90' test case
> > I'm adding.)
> 
> (Still interested if there's a way to do that.)
> 

You're question make so sense to me as it seems you're 
conflating IMPLICIT type with implicit interface.  The
F2018 standard has

  15.4.2.1 Interfaces and scopes

  The interface of a procedure is either explicit or implicit.
  It is explicit if it is 
    . an internal procedure, module procedure, or intrinsic procedure,
    · a subroutine, or a function with a separate result name, within
      the scoping unit that defines it, or
    · a procedure declared by a procedure declaration statement that
      specifies an explicit interface, or by an interface body.

  Otherwise, the interface of the identifier is implicit.  The interface
  of a statement function is always implicit.

These two program are equivalent

program foo
  external bar
  external bah
  call bar(a,i)
  x = bah()
end program

program foo
  call bar(a,i)
  x = bah()
end program

except the former explicitly tells the compiler that bar and bah
are external.  The "return type" with respect to C of bar is always
void.  All subroutines with either an explicit or implicit interface
have a void "return type".  The return type for bah() is *implicitly*
determined by the 'b' in the function function name.  In this case,
bar() has an implcit type of REAL.

-- 
Steve

Reply via email to