http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40054

--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 
2011-07-03 17:12:15 UTC ---
On Sun, Jul 03, 2011 at 04:25:39PM +0000, janus at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40054
> 
> --- Comment #9 from janus at gcc dot gnu.org 2011-07-03 16:24:53 UTC ---
> (In reply to comment #8)
> > > In any case, statement functions are obsolescent since F95, so would it 
> > > be an
> > > option to not support them with -std=f2008?
> > 
> > Obsolescent does not mean deleted.  Unfortunately, statement functions
> > are still valid Fortran.
> 
> Yes, I am aware of that. Do you have an idea how to implement both features at
> the same time, Steve?
> 

With your first example,

two() = 7
contains
  function two ()
    integer, pointer  :: two
    allocate(two)
  end function two
end

I think two() should be treated as a pointer function because
the standard states:

   The definition of a statement function with the same name
   as an accessible entity from the host shall be preceded by the
   declaration of its type in a type declaration statement.

For two() to be a statement function one would need to have
for example,

real two
two() = 7
contains
  !
  ! Is this now an error due to a redefinition of two() ???
  !
  function two ()  
    integer, pointer  :: two
    allocate(two)
  end function two
end

Also, as Tobias' noted an explicit interface is needed for a
pointer function.

Reply via email to