This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] RFC: PR fortran/37779, diagnose "missing" recursive


On Sun, Nov 16, 2008 at 06:12:56PM +0100, Daniel Kraft wrote:
> Steve Kargl wrote:
> >On Sun, Nov 16, 2008 at 01:09:10PM +0100, Daniel Kraft wrote:
> >> On the other hand, I guess this could lead to rejects-valid situations 
> >>and we should think about F77 compatibility where the solution of adding 
> >>"RECURSIVE" is not available.
> >
> >Daniel,
> >
> >I may not have understood what is written above.  It seems you
> >want to permit recursion without the RECURSIVE keyword to 
> >possibly allow Fortran 77 corner cases.  There are no corner
> >cases.  On page 15-2, in Section 15.2 of the Fortran 77 standard,
> >one finds:
> 
> Hi Steve,
> 
> actually I think that passing procedures as arguments is allowed in F77, 
> right?  The statement above was meant in combination with completely 
> rejecting non-recursive procedure expressions not only within the 
> procedure's own body; and this would make it completely impossible to 
> use this F77 feature from within F77.
> 
> Sorry it got confusing :)
> 

Yes, of course, a procedure can be passed as an actual argument to
a subprogram.

   subroutine foo
   external bar
   call sub(bar)
   end 

is fine.

   subroutine foo
   call sub(foo)
   end

does not make much sense unless sub() never actually references the
passed procedure foo.  The key sentence from the F77 standard is
"A subprogram must not reference itself, either directly or indirectly."

I suppose one could argue that the compiler may not know what sub()
does, so it can assume that foo won't be referenced.  With this
argument, I suppose a warning may be appropriate.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]